summaryrefslogtreecommitdiff
path: root/include/asterisk/res_odbc.h
AgeCommit message (Collapse)Author
2016-07-12func_odbc: Fix connection deadlock.Joshua Colp
The func_odbc module was modified to ensure that the previous behavior of using a single database connection was maintained. This was done by getting a single database connection and holding on to it. With the new multiple connection support in res_odbc this will actually starve every other thread from getting access to the database as it also maintains the previous behavior of having only a single database connection. This change disables the func_odbc specific behavior if the res_odbc module is running with only a single database connection active. The connection is only kept for the duration of the request. ASTERISK-26177 #close Change-Id: I9bdbd8a300fb3233877735ad3fd07bce38115b7f
2016-01-22res_odbc: Remove connection managementMark Michelson
Asterisk by default will create a single database connection and share it among all threads that attempt to access the database. In previous versions of Asterisk, this was tolerable, because the most used channel driver, chan_sip, mostly accessed the database from a single thread. With PJSIP, however, many threads may be attempting to perform database operations, and there is the potential for many more database accesses, meaning the concurrency is a horrible bottleneck if only one connection is shared. Asterisk has a connection pooling facility built into it, but the implementation has flaws. For one, there is a strict limit on the number of simultaneous connections that could be made to the database. Anything beyond the maximum would result in a failed operation. Attempting to predict what the maximum should be is nearly impossible even for someone intimately familiar with Asterisk's threading model. In addition, use of transactions in the dialplan can cause some severe bugs if connection pooling is enabled. This commit seeks to fix the concurrency problem by removing all connection management code from Asterisk and leaving that to the underlying unixODBC code instead. Now, Asterisk does not share a single connection, nor does it try to maintain a connection pool. Instead, all Asterisk ever does is request a connection from unixODBC and allow unixODBC to either allocate those connections or retrieve them from a pool. Doing this has a bit of a ripple effect. For one, since connections are not long-lived objects, several of the safeguards that previously existed have been removed. We don't have to worry about trying to use a connection that has gone stale. In every case, when we request a connection, it has just been made and we don't need to perform any sanity checks to be sure it's still active. Another major player affected by this change is transactions. Transactions and their respective connections were so tightly coupled that it was almost pornographic. This code change moves transaction-related code to its own file separate from the core ODBC functionality. This way, the core of ODBC does not even have to know that transactions exist. In making this large change, I had to look at a lot of code and understand it. When making this change, I discovered several places where the behavior is definitely not ideal, but it seemed outside the scope of this change to be fixing it. Instead, any place where I saw some sort of room for improvement has had a XXX comment added explaining what could be altered to improve it. Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2012-09-21Doxygen Updates - janitor workAndrew Latham
Doxygen updates including mistakes, misspellings, missing parameters, updates for Doxygen style. Some missing txt file links are removed but their content or essense will be included in some later updates. A majority of the txt files were removed in the 1.6 era but never noted. The HR and EXTREF are simple changes that make the documentation more compatable with more versions of Doxygen. Further updates coming. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27Converts locking for odbc containers from ast_mutex_lock to ao2_locks.Jonathan Rose
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-23Merge the realtime failover branchTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22Remove ABI differences that occured when compiling with DEBUG_THREADS.Jason Parker
"Bad Things" would happen if Asterisk was compiled with DEBUG_THREADS, but a loaded module was not (or vice versa). This also immensely simplifies the lock code, since there are no longer 2 separate versions of them. Review: https://reviewboard.asterisk.org/r/508/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-01Merge changes from str_substitution that are unrelated to that branch.Tilghman Lesher
Included is a small bugfix to an ast_str helper, but most of these changes are simply doxygen fixes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-09Add Doxygen documentation for API changes from 1.6.0 to 1.6.1Jeff Peeler
Copied from my review board description: This is a continuation of the API changes documentation started for describing changes between releases. Most of the API changes were pretty simple needing only to be brought to attention via the new "Asterisk API Changes" list. However, if you see anything that needs further explanation feel free to supplement what is there. The current method of documenting is to add (in the header file): \version <ver number> <description of changes> and then to add the function to the change list in doxyref.h on the AstAPIChanges page. I also made sure all the functions that were newly added were tagged with \since 1.6.1. I think this is a good habit to start both for the historical aspect as well as for the future ability to easily add a "New Asterisk API" page. Review: http://reviewboard.digium.com/r/190/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-19ODBC transaction supportTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177320 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-19ast_str_SQLGetData is *not* part of the ast_str API, it's part of the ↵Kevin P. Fleming
ast_odbc API and just happens to use an ast_str as the buffer; move all of it to res_odbc.c and res_odbc.h, renaming appropriately along the way fix some minor coding style issues in strings.h and add some attribute_pure annotations to functions in the ast_str API git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29incorporates r159808 from branches/1.4:Kevin P. Fleming
------------------------------------------------------------------------ r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them format attributes in a consistent way ------------------------------------------------------------------------ in addition: move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11Add some debug code and add a missing releaseTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-10Move the table cache routines to res_odbc, so they can be used from otherTilghman Lesher
places (app_voicemail, for example). (Related to bug #11678) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-05Merge the adaptive realtime branch, which will make adding new required fieldsTilghman Lesher
to realtime less painful in the future. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-05Merged revisions 115308 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115308 | tilghman | 2008-05-05 14:55:55 -0500 (Mon, 05 May 2008) | 2 lines Err, the documentation on the return value of ast_odbc_backslash_is_escape is exactly backwards. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-01Merged revisions 115102 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115102 | tilghman | 2008-05-01 18:20:25 -0500 (Thu, 01 May 2008) | 2 lines Change the comment of deprecated to an actual compiler deprecation ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-21Merged revisions 99341 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r99341 | tilghman | 2008-01-21 12:11:07 -0600 (Mon, 21 Jan 2008) | 8 lines Permit the user to specify number of seconds that a connection may remain idle, which fixes a crash on reconnect with the MyODBC driver. (closes issue #11798) Reported by: Corydon76 Patches: 20080119__res_odbc__idlecheck.diff.txt uploaded by Corydon76 (license 14) Tested by: mvanbaak ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-25Merged revisions 89559 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89559 | tilghman | 2007-11-25 11:17:10 -0600 (Sun, 25 Nov 2007) | 14 lines We previously attempted to use the ESCAPE clause to set the escape delimiter to a backslash. Unfortunately, this does not universally work on all databases, since on databases which natively use the backslash as a delimiter, the backslash itself needs to be delimited, but on other databases that have no delimiter, backslashing the backslash causes an error. So the only solution that I can come up with is to create an option in res_odbc that explicitly specifies whether or not backslash is a native delimiter. If it is, we use it natively; if not, we use the ESCAPE clause to make it one. Reported by: elguero Patch by: tilghman (Closes issue #11364) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-14Add a direct execute method to res_odbc (closes issue #10722)Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-16Merge a bunch of doxygen updates to header files. This includes changes toRussell Bryant
use the \retval tag for documenting return values, fixing various warnings when generating the documentation, and various other things. (closes issue #10203, snuffy) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-20move ODBC API into ast_ namespaceKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-18update res_odbc to support pooled connectionsRussell Bryant
(from tilghman's developer branch, res_odbc_rewrite) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29remove extraneous svn:executable propertiesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-09issue #5563Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7040 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-24Doxygen documentation update from oej (issue #5505)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-13fix typo in function name (issue #5437)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-30major header file cleanup: license, copyrights, descriptions, markers, etc.Kevin P. Fleming
remove deprecated config_old.c/config_old.h remove unused cvsid.h git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-02-17Merge anthm's ODBC sanity check fix (bug #3529)Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-01-21update copyright headers for 2005Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-10-05Major changes to res_config to support centralized config, eliminate ↵Mark Spencer
configuration of res_config_odbc, update config examples, integrate with iax2, remove mysql friends from iax2, put on flame retardant vest... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3914 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-06-11Merge res_odbc and res_configMark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3186 65c4cc65-6c06-0410-ace0-fbb531ad65f3