Author: kpvdr
Date: 2008-06-16 19:03:37 -0400 (Mon, 16 Jun 2008)
New Revision: 2153
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/TxnCtxt.h
store/trunk/cpp/lib/jrnl/jcntl.cpp
Log:
Fix for BZ "451432: jexception 0x0b01 txn_map::set_aio_compl() threw
JERR_MAP_NOTFOUND: Key not found in map". Reduced sleep time while waiting for AIO
retruns from 10ms to 1ms, which improves txn performance. Also set aio_complete flags for
recovered transactions.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-06-13 16:00:39 UTC (rev 2152)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-06-16 23:03:37 UTC (rev 2153)
@@ -215,8 +215,8 @@
log(LOG_DEBUG, "Recover phase II complete; journal now writable.");
}
-#define MAX_AIO_SLEEPS 500
-#define AIO_SLEEP_TIME 1000000
+#define MAX_AIO_SLEEPS 1000 // 10 sec
+#define AIO_SLEEP_TIME 10000 // 10 ms
bool
JournalImpl::loadMsgContent(u_int64_t rid, std::string& data, size_t offset, size_t
length)
{
Modified: store/trunk/cpp/lib/TxnCtxt.h
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.h 2008-06-13 16:00:39 UTC (rev 2152)
+++ store/trunk/cpp/lib/TxnCtxt.h 2008-06-16 23:03:37 UTC (rev 2153)
@@ -65,6 +65,7 @@
DbTxn* txn;
void completeTXN(bool commit){
+ sync();
for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i !=
impactedQueues.end(); i++) {
JournalImpl* jc = static_cast<JournalImpl*>(*i);
if (jc && loggedtx) { /* if using journal */
@@ -73,12 +74,12 @@
dtokp->set_external_rid(true);
dtokp->set_rid(loggedtx->next());
try{
- if (commit)
+ if (commit) {
jc->txn_commit(dtokp.get(), getXid());
- else
- {
- jc->txn_abort(dtokp.get(), getXid());
- }
+ jc->flush(true);
+ } else {
+ jc->txn_abort(dtokp.get(), getXid());
+ }
} catch (const journal::jexception& e) {
//std::cout << "Error commit" << e <<
std::endl;
THROW_STORE_EXCEPTION(std::string("Error commit") +
e.what());
@@ -86,7 +87,6 @@
}
}
- sync();
deleteXidRecord();
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-06-13 16:00:39 UTC (rev 2152)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-06-16 23:03:37 UTC (rev 2153)
@@ -510,8 +510,8 @@
ji.write();
}
-#define AIO_CMPL_SLEEP 10000 // 10 ms
-#define MAX_AIO_CMPL_SLEEPS 1000 // Total: 10 sec
+#define AIO_CMPL_SLEEP 1000 // 1 ms
+#define MAX_AIO_CMPL_SLEEPS 10000 // Total: 10 sec
void
jcntl::aio_cmpl_wait()
@@ -687,6 +687,7 @@
assert(xidp != 0);
std::string xid((char*)xidp, er.xid_size());
_tmap.insert_txn_data(xid, txn_data(h._rid, 0, fid, true));
+ _tmap.set_aio_compl(xid, h._rid);
std::free(xidp);
}
else
@@ -711,6 +712,7 @@
assert(xidp != 0);
std::string xid((char*)xidp, dr.xid_size());
_tmap.insert_txn_data(xid, txn_data(dr.rid(), dr.deq_rid(), fid,
false));
+ _tmap.set_aio_compl(xid, dr.rid());
std::free(xidp);
}
else
Show replies by date