summaryrefslogtreecommitdiffstats
path: root/tests/unit/db
Commit message (Collapse)AuthorAgeFilesLines
* Enable user to configure pool_timeoutGary Kotton2013-06-111-0/+2
| | | | | | | | | | Fixes bug 1160442 In addition to this there are the following changes: 1. The set_default method can configure the QueuePool parameters 2. The max_pool_size is defaulted to the QueuePool default Change-Id: Ie99f7fc4edba68127c4af508290d8074d7094be9
* Add a slave db handle for the SQLAlchemy backend.Michael Wilson2013-06-031-0/+20
| | | | | | | | | | | Adds an option for a slave DB connection for scaling purposes. Read queries can be sent here to spread out db load a bit. This patch adds a new configuration option: slave_connection. Implements: blueprint db-slave-handle Change-Id: I5cc5e0696e3fcd8609ee6b5466b0377ca52b8b58 DocImpact
* Specify database group instead of DEFAULTDavanum Srinivas2013-05-202-4/+76
| | | | | | | | | | | | At the request of Quantum folks, Let us switch from DEFAULT to database for the database related options. This will help with migration etc. DocImpact Fixes LP# 1171837 Change-Id: If602a6a7cc0f2a202632dd14574fea60dce4b589
* Fixes import order nitsZhongyue Luo2013-05-151-1/+1
| | | | Change-Id: I4fdc8eed74dd90d6450864daba7492d5e7266448
* Add test coverage for sqlite regexp functionMark McLoughlin2013-05-021-1/+58
| | | | | | | | | | Add some tests which for the regexp function which we install for sqlite. Need test coverage to catch e.g. a regression of the fix for bug #1031846. Change-Id: I4bd77d0d93c4fc85588e6e6d5a559e68133dbf73
* Removes created_at, updated_at from ModelBaseZhongyue Luo2013-04-111-0/+22
| | | | | | | | | Created a 'TimestampMixin' class. Next step is to update Nova which is the only project using oslo.db Fixes bug #1119702 Change-Id: I1ffcc09a2971e6e6102da7ecb855a2837a159baf
* Clean up sqlalchemy exception codeChris Behrens2013-02-221-10/+3
| | | | | | | | | | | Moves DB exceptions that can be shared between DB implementations into their own module. Adds DBDeadlock() exception wrapping. Nova has its own code for determining Deadlock and it's better to consolidate it with DBDuplicateKey checking. Change-Id: I108bd0da2a14d62e460a997b1472f0b65bfc9b95
* Move DB thread pooling to DB API loaderChris Behrens2013-02-182-40/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1128605 The dbpool code in sqlalchemy session is the wrong place to implement thread pooling as it wraps each individual SQL call to run in its own thread. When combined with SQL server locking, all threads can be eaten waiting on locks with none available to run a 'COMMIT'. The correct place to do thread pooling is around each DB API call. This patch removes dbpool from sqlalchemy and creates a common DB API loader for all openstack projects which implements the following configuration options: db_backend: Full path to DB API backend module (or a known short name if a project chooses to implement a mapping) dbapi_use_tpool: True or False whether to use thread pooling around all DB API calls. DB backend modules must implement a 'get_backend()' method. Example usage for nova/db/api.py would be: """ from nova.openstack.common.db import api as db_api _KNOWN_BACKENDS = {'sqlalchemy': 'nova.db.sqlalchemy.api'} IMPL = db_api.DBAPI(backend_mapping=_KNOWN_BACKENDS) """ NOTE: Enabling thread pooling will be broken until this issue is resolved in eventlet _OR_ until we modify our eventlet.monkey_patch() calls to include 'thread=False': https://bitbucket.org/eventlet/eventlet/issue/137/ Change-Id: Idf14563ea07cf8ccf2a77b3f53659d8528927fc7
* Use importutils.try_import() for MySQLdbMark McLoughlin2013-02-071-6/+4
| | | | | | This is a common pattern we've adopted elsewhere, so use it here too. Change-Id: I2e0947b4857005b478e796e9c9a7c05ea1f0d926
* Minor tweak to make update.py happyMark McLoughlin2013-02-071-1/+1
| | | | | | | Fairly lame to do this instead of just fixing update.py, but we seem to do it this way everywhere else, so ... Change-Id: Ie1cebcfec57c6138b9b726d7d3bc6e0ea456f146
* Remove pointless use of OpenStackExceptionMark McLoughlin2013-02-071-2/+1
| | | | | | | The use of the base exception does nothing for the test but means the "dead module walking" exception module. Change-Id: Ibd7bb8aa526be366f005ab5e12fd4da89a976c57
* Remove unused context from test_sqlalchemyMark McLoughlin2013-02-071-2/+0
| | | | Change-Id: I0b3c7341e91cfc57aed625754bc9bf009ef70b14
* Remove openstack.common.db.commonMark McLoughlin2013-02-071-3/+2
| | | | | | | | | | | | Since this only contains exceptions that are either used in session.py or utils.py (not both), it seems sensible to move them into the modules where they are used. Also, remove the use of the Invalid base exception class since we don't seem to be making use of the base class anywhere by catching it rather than the more specialized exceptions. Change-Id: Ib05bb2e0a9494e1dc60c60b8eee0e76b5d2ee555
* Fix missing wrap_db_error for Session.execute() methodBoris Pavlovic2013-02-071-0/+63
| | | | | | | | | | | | | We should add wrap_db_error for Session.execute() method, because Query.update() method will call Session.execute() and it is not inside Session.flush(), so exceptions from Query.update() wouldn't be wrapped. Add test for Session.flush() wrapper Add test for Session.execute() wrapper Fixes bug 1107890 Change-Id: I96894e502f9f279999b61a1e66469e34a07a022d
* Import sqlalchemy session/models/utilsEric Windisch2013-02-054-0/+176
Bring in session, base model, utilities, and tests for sqlalchemy from Nova. Add sqlalchemy to pip-requires and and python-mysql to test-requires. Partially implements blueprint common-db Change-Id: I3e0065cdac87e10c4e0742d66c293c72bb3acbb2