summaryrefslogtreecommitdiff
path: root/test/engine/test_reconnect.py
Commit message (Collapse)AuthorAgeFilesLines
* First level repair for cx_Oracle 6.0 test regressionsMike Bayer2017-08-181-0/+3
| | | | | | | | | | | | Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only behavioral change for users is disconnect detection now detects for cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as this behavior seems to have changed. Other issues regarding numeric precision and uncloseable connections are pending with the upstream cx_Oracle issue tracker. Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b Fixes: #4045
* Add safe_reraise() + warnings only to Connection._autorollbackMike Bayer2017-03-271-20/+41
| | | | | | | | | | | | Added an exception handler that will warn for the "cause" exception on Py2K when the "autorollback" feature of :class:`.Connection` itself raises an exception. In Py3K, the two exceptions are naturally reported by the interpreter as one occurring during the handling of the other. This is continuing with the series of changes for rollback failure handling that were last visited as part of :ticket:`2696` in 1.0.12. Change-Id: I600ba455a14ebaea27c6189889181f97c632f179 Fixes: #3946
* Integrate "pre-ping" into connection pool.Mike Bayer2017-03-201-2/+147
| | | | | | | | | | | | | | | Added native "pessimistic disconnection" handling to the :class:`.Pool` object. The new parameter :paramref:`.Pool.pre_ping`, available from the engine as :paramref:`.create_engine.pool_pre_ping`, applies an efficient form of the "pre-ping" recipe featured in the pooling documentation, which upon each connection check out, emits a simple statement, typically "SELECT 1", to test the connection for liveness. If the existing connection is no longer able to respond to commands, the connection is transparently recycled, and all other connections made prior to the current timestamp are invalidated. Change-Id: I89700d0075e60abd2250e54b9bd14daf03c71c00 Fixes: #3919
* - add ad_hoc_engines to remove RealReconnectTest from oracleMike Bayer2017-03-141-1/+1
| | | | Change-Id: Ie40aeba87dcfe9e8216abb8be050e7c2cc5b5ec9
* Handle BaseException in all _handle_dbapi_errorMike Bayer2016-09-211-3/+91
| | | | | | | | | | | | | | | | | Tests illustrate that exceptions like GreenletExit and even KeyboardInterrupt can corrupt the state of a DBAPI connection like that of pymysql and mysqlclient. Intercept BaseException errors within the handle_error scheme and invalidate just the connection alone in this case, but not the whole pool. The change is backwards-incompatible with a program that currently intercepts ctrl-C within a database transaction and wants to continue working on that transaction. Ensure the event hook can be used to reverse this behavior. Change-Id: Ifaa013c13826d123eef34e32b7e79fff74f1b21b Fixes: #3803
* - add a do-nothing for mock url _instantiate_pluginsMike Bayer2016-01-061-0/+1
|
* - fix some tests related to the URL change and try to makeMike Bayer2015-05-231-0/+4
| | | | the URL design a little simpler
* - Fixed bug in :class:`.Connection` and pool where theMike Bayer2015-02-041-0/+10
| | | | | | | | | :meth:`.Connection.invalidate` method, or an invalidation due to a database disconnect, would fail if the ``isolation_level`` parameter had been used with :meth:`.Connection.execution_options`; the "finalizer" that resets the isolation level would be called on the no longer opened connection. fixes #3302
* - simplify the "noconnection" error handling, settingMike Bayer2014-12-081-2/+2
| | | | | | | _handle_dbapi_exception_noconnection() to only invoke in the case of raw_connection() in the constructor of Connection. in all other cases the Connection proceeds with _handle_dbapi_exception() including revalidate.
* - adjust _revalidate_connection() again such that we pass a _wrap=FalseMike Bayer2014-12-051-2/+2
| | | | | | | | | | to it, so that we say we will do the wrapping just once right here in _execute_context() / _execute_default(). An adjustment is made to _handle_dbapi_error() to not assume self.__connection in case we are already in an invalidated state further adjustment to 0639c199a547343d62134d2f233225fd2862ec45, 41e7253dee168b8c26c49, #3266
* - Fixed bug where a "branched" connection, that is the kind you getMike Bayer2014-09-261-10/+26
| | | | | | | | when you call :meth:`.Connection.connect`, would not share transaction status with the parent. The architecture of branching has been tweaked a bit so that the branched connection defers to the parent for all transactional status and operations. fixes #3190
* - Fixed bug where a "branched" connection, that is the kind you getMike Bayer2014-09-261-0/+32
| | | | | | | | when you call :meth:`.Connection.connect`, would not share invalidation status with the parent. The architecture of branching has been tweaked a bit so that the branched connection defers to the parent for all invalidation status and operations. fixes #3215
* PEP8 tidy of test/engine/test_reconnectTony Locke2014-08-021-58/+52
|
* - more pg8000 tests passingMike Bayer2014-07-251-1/+2
|
* - vastly improve the "safe close cursor" tests in test_reconnectMike Bayer2014-05-301-14/+57
| | | | | | | | | | | - Fixed bug which would occur if a DBAPI exception occurs when the engine first connects and does its initial checks, and the exception is not a disconnect exception, yet the cursor raises an error when we try to close it. In this case the real exception would be quashed as we tried to log the cursor close exception via the connection pool and failed, as we were trying to access the pool's logger in a way that is inappropriate in this very specific scenario. fixes #3063
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* - fix the uuid routine here to not run out of uuidsMike Bayer2014-03-241-0/+5
|
* - A major improvement made to the mechanics by which the :class:`.Engine`Mike Bayer2014-03-221-6/+8
| | | | | | | | | | | | recycles the connection pool when a "disconnect" condition is detected; instead of discarding the pool and explicitly closing out connections, the pool is retained and a "generational" timestamp is updated to reflect the current time, thereby causing all existing connections to be recycled when they are next checked out. This greatly simplifies the recycle process, removes the need for "waking up" connect attempts waiting on the old pool and eliminates the race condition that many immediately-discarded "pool" objects could be created during the recycle operation. fixes #2985
* - remove informix dialect, moved out to ↵Mike Bayer2013-11-171-10/+0
| | | | | | https://bitbucket.org/zzzeek/sqlalchemy_informixdb - remove informix, maxdb, access symbols from tests etc.
* Dialect.initialize() is not called a second time if an :class:`.Engine`Mike Bayer2013-07-111-3/+31
| | | | | | is recreated, due to a disconnect error. This fixes a particular issue in the Oracle 8 dialect, but in general the dialect.initialize() phase should only be once per dialect. Also in 0.8.3. [ticket:2776]
* - replace most explicitly-named test objects called "Mock..." withMike Bayer2013-06-301-225/+218
| | | | | | | | | | | | actual mock objects from the mock library. I'd like to use mock for new tests so we might as well use it in obvious places. - use unittest.mock in py3.3 - changelog - add a note to README.unittests - add tests_require in setup.py - have tests import from sqlalchemy.testing.mock - apply usage of mock to one of the event tests. we can be using this approach all over the place.
* - additional oracle fixes. cx_oracle under py3k is complaining about tuples ↵Mike Bayer2013-05-271-1/+4
| | | | | | | to executemany(), so just unconditionally turn this into a list - this one test segfaults only on py3k + cx_oracle
* merge defaultMike Bayer2013-04-301-2/+2
|\
| * missing commaMike Bayer2013-04-301-2/+2
| |
* | merge defaultMike Bayer2013-04-291-13/+6
|\ \ | |/
| * Updated mysqlconnector dialect to check for disconnect basedMike Bayer2013-04-291-13/+6
| | | | | | | | | | on the apparent string message sent in the exception; tested against mysqlconnector 1.0.9.
* | - the raw 2to3 runMike Bayer2013-04-271-12/+12
|/ | | | - went through examples/ and cleaned out excess list() calls
* - test + changelog for [ticket:2691]Mike Bayer2013-04-181-1/+23
|
* Improvements to Connection auto-invalidationMike Bayer2013-04-111-14/+122
| | | | | | | | | | | | | handling. If a non-disconnect error occurs, but leads to a delayed disconnect error within error handling (happens with MySQL), the disconnect condition is detected. The Connection can now also be closed when in an invalid state, meaning it will raise "closed" on next usage, and additionally the "close with result" feature will work even if the autorollback in an error handling routine fails and regardless of whether the condition is a disconnect or not. [ticket:2695]
* mymysql dialectHajime Nakagami2013-03-011-0/+3
|
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-6/+7
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* -whitespace bonanza, contdMike Bayer2012-07-281-3/+3
|
* - [bug] Fixed bug whereby if a database restartMike Bayer2012-06-221-0/+27
| | | | | | | affected multiple connections, each connection would individually invoke a new disposal of the pool, even though only one disposal is needed. [ticket:2522]
* - [bug] Fixed bug whereby transaction.rollback()Mike Bayer2011-12-041-0/+21
| | | | | | | | | | | would throw an error on an invalidated connection if the transaction were a two-phase or savepoint transaction. For plain transactions, rollback() is a no-op if the connection is invalidated, so while it wasn't 100% clear if it should be a no-op, at least now the interface is consistent. [ticket:2317]
* - make sure we definitely get every connection createdMike Bayer2011-05-141-0/+1
| | | | | - ensure we lose self.conns, cx_oracle only closes on __del__ - fix reconnectingfixture to lose all connection references
* - hardcore force every connection into a strong-referenced set, rollback on ↵Mike Bayer2011-04-251-4/+10
| | | | | | | | | every test, close on every context. this uses pool events but bypasses the pool's fairy/record/dispose services. pypy still seems to expose some holes in that at least as far as what some (or maybe just one, cant find it yet) of the tests does. haven't tested this too deeply, just on sqlite + postgres, cypthon 2.7 + pypy. will see what the buildbot says
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-6/+7
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace
* - Non-DBAPI errors which occur in the scope of an `execute()`Mike Bayer2011-02-091-15/+12
| | | | | | | | call are now wrapped in sqlalchemy.exc.StatementError, and the text of the SQL statement and repr() of params is included. This makes it easier to identify statement executions which fail before the DBAPI becomes involved. [ticket:2015]
* - add connection and cursor to is_disconnect(). We aren't using it yet,Mike Bayer2011-02-091-4/+35
| | | | | | | | | | | | | | | but we'd like to. Most DBAPIs don't give us anything we can do with it. Some research was done on psycopg2 and it still seems like they give us no adequate method (tried connection.closed, cursor.closed, connection.status). mxodbc claims their .closed attribute will work (but I am skeptical). - remove beahvior in pool that auto-invalidated a connection when the cursor failed to create. That's not the pool's job. we need the conn for the error logic. Can't get any tests to fail, curious why that behavior was there, guess we'll find out (or not). - add support for psycopg2 version detection. even though we have no use for it yet... - adjust one of the reconnect tests to work with oracle's horrendously slow connect speed
* - New DBAPI support for pymysql, a pure Python portMike Bayer2011-01-261-0/+3
| | | | of MySQL-python. [ticket:1991]
* - whitespace removal bonanzaMike Bayer2011-01-021-14/+14
|
* - sqlalchemy.test and nose plugin moves back to being entirelyMike Bayer2010-11-281-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | outside of "sqlalchemy" and under "test/". Rationale: - coverage plugin works without issue, without need for an awkward additional package install - command line for "nosetests" isn't polluted with SQLAlchemy options [ticket:1949]
| * - move sqlalchemy.test to test.libMike Bayer2010-11-151-4/+4
| |
* | - initial patch for [ticket:1926]Mike Bayer2010-11-171-1/+1
|/
* - *Major* cleanup / modernization of the InformixMike Bayer2010-10-011-2/+12
| | | | | dialect for 0.6, courtesy Florian Apolloner. [ticket:1906]
* - replaced all self.__connection.is_valid withMike Bayer2010-08-261-4/+35
| | | | | | | | | | | "safe" self._connection_is_valid. - Fixed bug in Connection whereby if a "disconnect" event occurred in the "initialize" phase of the first connection pool connect, an AttributeError would be raised when the Connection would attempt to invalidate the DBAPI connection. [ticket:1894] - Connection.invalidate() can be called more than once and subsequent calls do nothing.
* Python-tidy test/engine and test/aaa_profiling, 80% auto + 20% manual ↵Mike Bayer2010-07-111-45/+41
| | | | intervention
* merge tipMike Bayer2010-05-031-2/+35
|\
| * - Fixed bug in connection pool cursor wrapper whereby if aMike Bayer2010-04-281-0/+28
|/ | | | | cursor threw an exception on close(), the logging of the message would fail. [ticket:1786]
* merge 0.6 series to trunk.Mike Bayer2009-08-061-8/+10
|