[rhmessaging-commits] rhmessaging commits: r3039 - store/trunk/cpp/lib.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Jan 14 07:55:31 EST 2009
Author: kpvdr
Date: 2009-01-14 07:55:30 -0500 (Wed, 14 Jan 2009)
New Revision: 3039
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
Log:
Fix for BZ472937 - "TPL recoverTplStore() failed: jexception 0x0b01 txn_map::get_tdata_list() threw JERR_MAP_NOTFOUND: Key not found in map. (xid=rhm-tid0x2aac2c9b0ee0) (MessageStoreImpl.cpp:1079)".
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-01-12 16:58:29 UTC (rev 3038)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-01-14 12:55:30 UTC (rev 3039)
@@ -1037,27 +1037,40 @@
bool is2PC = *(static_cast<char*>(dbuff)) != 0;
// Check transaction details; add to recover map
- journal::txn_data_list txnList = tmap.get_tdata_list(xid);
- unsigned enqCnt = 0;
- unsigned deqCnt = 0;
- u_int64_t rid = 0;
+ // NOTE: There is a small but finite probability that the xid read above may have been removed by
+ // another thread on one of the active queues by the time the get_tdata_list() call below is made.
+ // Since reading the TPL is not considered a high-speed operation and is used for recovery and other
+ // infrequent uses, the following try-catch will work as well as attempting to lock down the
+ // entire transaction map for this operation - but with less complixity.
+ try {
+ journal::txn_data_list txnList = tmap.get_tdata_list(xid);
+ unsigned enqCnt = 0;
+ unsigned deqCnt = 0;
+ u_int64_t rid = 0;
- // Assume commit (roll forward) in cases where only prepare has been called - ie only enqueue record exists.
- // Note: will apply to both 1PC and 2PC transactions.
- bool commitFlag = true;
+ // Assume commit (roll forward) in cases where only prepare has been called - ie only enqueue record exists.
+ // Note: will apply to both 1PC and 2PC transactions.
+ bool commitFlag = true;
- for (journal::tdl_itr j = txnList.begin(); j<txnList.end(); j++) {
- if (j->_enq_flag) {
- rid = j->_rid;
- enqCnt++;
- } else {
- commitFlag = j->_commit_flag;
- deqCnt++;
+ for (journal::tdl_itr j = txnList.begin(); j<txnList.end(); j++) {
+ if (j->_enq_flag) {
+ rid = j->_rid;
+ enqCnt++;
+ } else {
+ commitFlag = j->_commit_flag;
+ deqCnt++;
+ }
}
+ assert(enqCnt == 1);
+ assert(deqCnt <= 1);
+ tplRecoverMap.insert(TplRecoverMapPair(xid, TplRecoverStruct(rid, deqCnt == 1, commitFlag, is2PC)));
}
- assert(enqCnt == 1);
- assert(deqCnt <= 1);
- tplRecoverMap.insert(TplRecoverMapPair(xid, TplRecoverStruct(rid, deqCnt == 1, commitFlag, is2PC)));
+ catch (const journal::jexception& e) {
+ ::free(xidbuff);
+ aio_sleep_cnt = 0;
+ if (e.err_code() == journal::jerrno::JERR_MAP_NOTFOUND) break; // ignore this xid; move on
+ throw;
+ }
::free(xidbuff);
aio_sleep_cnt = 0;
More information about the rhmessaging-commits
mailing list