diff options
| author | Alan Conway <aconway@apache.org> | 2013-10-29 15:23:49 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-10-29 15:23:49 +0000 |
| commit | 1731c3ba99577fa515985609a675afd89e5c91e4 (patch) | |
| tree | 8432209a8e11f28fca72d8d7972016572da0f3c6 /qpid/cpp/src/tests/TxBufferTest.cpp | |
| parent | 7033bf67ab672fafc57d374f8a727cc8e4b7c54e (diff) | |
| download | qpid-python-1731c3ba99577fa515985609a675afd89e5c91e4.tar.gz | |
QPID-5139: HA transactions block a thread, can deadlock the broker
PrimaryTxObserver::prepare used to block pending responses from each backup. With
concurrent transactions this can deadlock the broker: once all worker threads
are blocked in prepare, responses from backups cannot be received.
This commit generalizes the async completion mechanism for messages to allow
async completion of arbitrary commands. It leaves the special-case code for
messages undisturbed but adds a second path (starting from
SessionState::handleCommand) for async completion of other commands.
In particular it implements tx.commit to allow async completion.
TxBuffer is now an AsyncCompletion and commitLocal() is split into
- startCommit() called by SemanticState::commit()
- endCommit() called when the commit command completes
TxAccept no longer holds pre-computed ranges, compute fresh each time.
- Avoid range iterators going out of date during a delayed commit.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1536754 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/TxBufferTest.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/TxBufferTest.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qpid/cpp/src/tests/TxBufferTest.cpp b/qpid/cpp/src/tests/TxBufferTest.cpp index 4807026ab7..3f052d213e 100644 --- a/qpid/cpp/src/tests/TxBufferTest.cpp +++ b/qpid/cpp/src/tests/TxBufferTest.cpp @@ -20,6 +20,7 @@ */ #include "qpid/broker/TxBuffer.h" #include "unit_test.h" +#include "test_tools.h" #include <iostream> #include <vector> #include "TxMocks.h" @@ -50,7 +51,8 @@ QPID_AUTO_TEST_CASE(testCommitLocal) buffer.enlist(static_pointer_cast<TxOp>(opB));//opB enlisted twice buffer.enlist(static_pointer_cast<TxOp>(opC)); - BOOST_CHECK(buffer.commitLocal(&store)); + buffer.startCommit(&store); + buffer.endCommit(&store); store.check(); BOOST_CHECK(store.isCommitted()); opA->check(); @@ -75,7 +77,12 @@ QPID_AUTO_TEST_CASE(testFailOnCommitLocal) buffer.enlist(static_pointer_cast<TxOp>(opB)); buffer.enlist(static_pointer_cast<TxOp>(opC)); - BOOST_CHECK(!buffer.commitLocal(&store)); + try { + ScopedSuppressLogging sl; // Suppress messages for expected error. + buffer.startCommit(&store); + buffer.endCommit(&store); + BOOST_FAIL("Expected exception"); + } catch (...) {} BOOST_CHECK(store.isAborted()); store.check(); opA->check(); |
