diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-05 10:42:28 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-05 10:42:28 +0200 |
commit | 8eab2b67fdf83c657f996debfc238703a78b337b (patch) | |
tree | af23c674490c9e05c281ecd56b3e439f32229795 /tests/storagetest.cpp | |
parent | 4bc39b1b771aaf9ae5f7c96aeaddb06f2bd101ac (diff) | |
download | sink-8eab2b67fdf83c657f996debfc238703a78b337b.tar.gz sink-8eab2b67fdf83c657f996debfc238703a78b337b.zip |
Don't leak transactions when copying them.
Previsouly we would hit the maxreaders limit
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r-- | tests/storagetest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index 7202628..dfb91ec 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -487,6 +487,24 @@ private slots: | |||
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | void testCopyTransaction() | ||
491 | { | ||
492 | Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadWrite); | ||
493 | { | ||
494 | auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadWrite); | ||
495 | transaction.openDatabase("a", nullptr, false); | ||
496 | transaction.openDatabase("b", nullptr, false); | ||
497 | transaction.openDatabase("c", nullptr, false); | ||
498 | transaction.commit(); | ||
499 | } | ||
500 | auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | ||
501 | for (int i = 0; i < 1000; i++) { | ||
502 | transaction.openDatabase("a", nullptr, false); | ||
503 | transaction.openDatabase("b", nullptr, false); | ||
504 | transaction.openDatabase("c", nullptr, false); | ||
505 | transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | ||
506 | } | ||
507 | } | ||
490 | }; | 508 | }; |
491 | 509 | ||
492 | QTEST_MAIN(StorageTest) | 510 | QTEST_MAIN(StorageTest) |