summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/qpid-txtest2.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QPID-7207: remove cpp and python subdirs from svn trunk, they have migrated ↵Robert Gemmell2016-07-051-363/+0
| | | | | | to their own git repositories git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1751566 13f79535-47bb-0310-9956-ffa450edef68
* QPID-4710: [AMQP 1.0] Support for transactions in qpid::messaging C++ client.Alan Conway2015-02-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements the "transactional retire and settle immediately" option for transactions as specified in AMQP 1.0 in the qpid::messaging C++ client. NOTE: Transactions over AMQP 1.0 require proton 0.9 or greater. With older versions, attempting a transactions over AMQP 1.0 will raise a link-detached exception "Node not found: tx-transaction" 1. Added descriptor list to Variant with support in Encoder and PnData. Required to support transactions, need to be able to create described lists. Variant changes are source and binary compatible. A Variant now has a Variant::List of descripors which can be numeric or string. Nested descriptors are implemented by putting multiple descriptors in the list. Other minor changes: - Variant refactor: don't delete impl on every assignment. - Add Variant constructors that take a string encoding. (new constructors, not defaulted arguments, so the change is binary and source compatible.) - Growable buffer support for Encoder. - Printing described Variant prints descriptors in form @descriptor value 2. Added transaction support to AMQP 1.0 client code Added messaging/amqp/Transaction.h,cpp: transaction logic - communicate with coordinator, send declare/dischange messages. - add tx state info to transfers and acknowledgements. - Sync session after discharge. - A transactional session automatically acks any message retrieved by fetch/get to bring them into the transaction. This is consistent the 0-10 client. Minor fixes to existing client code: - Fix use of pn_drain API in C++ client to work with C++ and Java brokers. - Make amqp::Exception derive from qpid::Exception 3. Fixes to existing broker code: - Incoming.cpp fix: start async completion before processing message. - Delay accept of dischage message till commit is complete. - newSession - handle failover during session creation. 4. Added tests interop_tests.py: transaction tests that can run against an external broker, see comments. ha_tests.py: Enable transaction tests over AMQP 1.0. Minor test fixes: - brokertest.py don't set default logging if QPID_LOG env vars set. - brokertest.py Pass kwargs to broker() create function. - qpid-receive: capacity should never be larger than message count. - Accept user:pass as well as user/pass in Url. - brokertest.py: Always do a ready() check on all brokers. If proton < 0.9 is used, transaction tests will be skipped or will downgrade to the amqp0-10 protocol with a printed warning. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1662743 13f79535-47bb-0310-9956-ffa450edef68
* NO-JIRA: Explictily convert double to uint64_t in qpid-txtest2 to avoid ↵Alan Conway2014-09-031-1/+1
| | | | | | warnings on some compilers. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1622372 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5855: Fix to JAVA Client Can not recieve message with qpid ha cluster.Alan Conway2014-08-291-2/+4
| | | | | | | | | | | | | | The original fix for this introduced a regression, running the qpid-txttest2 test against a cluster with the linear store failed. This fixes the fix. - Run transaction commit logic when the commit completes. Report completion to the user only when all prior commands have completed (sync point) - Fix missing initializer in client/amqp0_10/SessionImpl.cpp for transaction committing flag. - Remove annoying log messages from IdSetter.h - Skip transactional messages in prepare, don't wait till commit. - Added fetch-timeout option to qpid-txtest2 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1621368 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5975: HA extra/missing messages when running qpid-txtest2 in a loop ↵Alan Conway2014-08-281-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with failover. This is partly not-a-bug, there is a client error handling issue that has been corrected. qpid-txtest2 initializes a queue with messages at the start and drains the queues at the end. These operations are *not transactional*. Therefore duplicates are expected if there is a failover during initialization or draining. When duplicates were observed, there was indeed a failover at one of these times. Making these operations transactional is not enough to pass, now we see the test fail with "no messages to fetch". This is explained as follows: If there is a failover during a transaction, TransactionAborted is raised. The client assumes the transaction was rolled back and re-plays it. However, if the failover occurs at a critical point *after* the client has sent commit but *before* it has received a response, then the the client *does not know* whether the transaction was committed or rolled-back on the new primary. Re-playing in this case can duplicate the transaction. Each transaction moves messages from one queue to another so as long as transactions are atomic the total number of messages will not change. However, if transactions are duplicated, a transactional session may try to move more messages than exist on the queue, hence "no messages to fetch". For example if thread 1 moves N messages from q1 to q2, and thread 2 tries to move N+M messages back, then thread 2 will fail. This problem has been corrected as follows: C++ and python clients now raise the following exceptions: - TransactionAborted: The transaction has definitely been rolled back due to a connection failure before commit or a broker error (e.g. a store error) during commit. It can safely be replayed. - TransactionUnknown: The transaction outcome is unknown because the connection failed at the critical time. There's no simple automatic way to know what happened without examining the state of the broker queues. Unfortunately With this fix qpid-txtest2 is no longer useful test for TX failover because it regularly raises TransactionUnknown and there's not much we can do with that. A better test of TX atomicity with failover is to run a pair of qpid-send/qpid-receive with fail-over and verify that the number of enqueues/dequeues and message depth are a multiple of the transaction size. See the JIRA for such a test. (Note these test also sometimes raise TransactionUnknown but it doesn't matter since all we are checking is that messages go on and off the queues in multiple of the TX size.) ) Note: the original bug also reported seeing missing messages from qpid-txtest2. I don't have a good explanation for that but since the qpid-send/receive test shows that transactions are atomic I am going to let that go for now. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1621211 13f79535-47bb-0310-9956-ffa450edef68
* QPID-6020: HA logging improvements - log prefix with status and ID.Alan Conway2014-08-191-2/+2
| | | | | | | | | | | | | | | | | Include broker status and ID in (almost) all logging messages. Makes it much easier to track broker state and interactions. Sundry other logging improvements including: - Demote noisy messages to trace - connections from rgmanager status checks, searching for primary. - Rationalise start-up messages. - Improved queue state detail replicating subscription and queue guard initialization. - Fail to prepare TX is error. - Collect all primary TX errors into one. - Fix status of catchup brokers in primary membership for logging. - Add process name/PID info to client connection messages. - Various minor message tweaks. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1619003 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5966: HA mixing tx enqueue and non-tx dequeue leaves extra messages on ↵Alan Conway2014-08-081-1/+11
| | | | | | | | | | | | | | | | | | | | | backup. There were several problems: 1. Positions of transactionally enqueued messages not known to QueueReplicator, so not dequeued on backup if dequeued outside a TX on primary. 2. Race condition if tx created immediately after queue could cause duplication of TX message. 3. Replication IDs were not being set during recovery from store (regression, store change?) Fix: 1. Update positions QueueReplicator positions via QueueObserver::enqueued to see all enqueues. 2. Check for duplicate replication-ids on backup in QueueReplicator::route. 3. Set replication-id in publish() if not already set in record(). git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1616704 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5888: transaction should always be aborted on failoverAlan Conway2014-07-181-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++ and python clients were attempting to continue the transation transparently after failover which is in correct. They were re-sending messages in the transaction but there is no way to re-do transactional receives. The transaction must be aborted. The C++ and python clients have been modified to kill a transactional session with a TransactionAborted exception if there is a failover. Note the Java client already behaves correctly but not identically. It defers raising an exception until commit rather than failing immediately on failover, and the session can still be used. The following commits are involved: r1611349 QPID-5887: revised approach to implict abort r1610959 QPID-5887: allow qpid-txtest2 to be run by make test r1610958 QPID-5887: fix to new txtest2, acknowledge messages in the check phase to ensure queues remain drained for any subsequent runs r1609748 QPID-5887: abort transactional session on failover; added equivalent of txtest using messaging API This commit does the following: - Update ha_tests.py tx_simpler_failover test to expect transaction aborted. - Minor improvements to qpid-txtest2 - Fix native (non-swig) python client. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611748 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5887: revised approach to implict abortGordon Sim2014-07-171-10/+19
| | | | git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611349 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5887: allow qpid-txtest2 to be run by make testGordon Sim2014-07-161-1/+15
| | | | git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1610959 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5887: fix to new txtest2, acknowledge messages in the check phase to ↵Gordon Sim2014-07-161-0/+1
| | | | | | ensure queues remain drained for any subsequent runs git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1610958 13f79535-47bb-0310-9956-ffa450edef68
* QPID-5887: abort transactional session on failover; added equivalent of ↵Gordon Sim2014-07-111-0/+314
txtest using messaging API git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1609748 13f79535-47bb-0310-9956-ffa450edef68