Author: kpvdr
Date: 2010-08-17 13:33:36 -0400 (Tue, 17 Aug 2010)
New Revision: 4211
Modified:
store/trunk/cpp/lib/TxnCtxt.cpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
Log:
Fix for BZ 624452 - "Race condition in store orphans some TPL records, causing TPL to
hit enqueue threshold".
Modified: store/trunk/cpp/lib/TxnCtxt.cpp
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.cpp 2010-08-13 14:34:55 UTC (rev 4210)
+++ store/trunk/cpp/lib/TxnCtxt.cpp 2010-08-17 17:33:36 UTC (rev 4211)
@@ -100,8 +100,10 @@
void TxnCtxt::jrnl_sync(JournalImpl* jc, timespec* timeout) {
if (!jc || jc->is_txn_synced(getXid()))
return;
- if (jc->get_wr_events(timeout) == journal::jerrno::AIO_TIMEOUT &&
timeout)
- THROW_STORE_EXCEPTION(std::string("Error: timeout waiting for
TxnCtxt::jrnl_sync()"));
+ while (jc->get_wr_aio_evt_rem()) {
+ if (jc->get_wr_events(timeout) == journal::jerrno::AIO_TIMEOUT &&
timeout)
+ THROW_STORE_EXCEPTION(std::string("Error: timeout waiting for
TxnCtxt::jrnl_sync()"));
+ }
}
void TxnCtxt::begin(DbEnv* env, bool sync) {
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-08-13 14:34:55 UTC (rev 4210)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-08-17 17:33:36 UTC (rev 4211)
@@ -44,7 +44,6 @@
#include "jrnl/file_hdr.hpp"
#include "jrnl/jerrno.hpp"
#include "jrnl/jinf.hpp"
-#include "jrnl/slock.hpp"
#include <limits>
#include <sstream>
#include <unistd.h>
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-08-13 14:34:55 UTC (rev 4210)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-08-17 17:33:36 UTC (rev 4211)
@@ -47,6 +47,7 @@
#include "jrnl/fcntl.hpp"
#include "jrnl/lpmgr.hpp"
#include "jrnl/rcvdat.hpp"
+#include "jrnl/slock.hpp"
#include "jrnl/smutex.hpp"
#include "jrnl/rmgr.hpp"
#include "jrnl/wmgr.hpp"
@@ -563,6 +564,10 @@
inline u_int32_t get_enq_cnt() const { return _emap.size(); }
+ inline u_int32_t get_wr_aio_evt_rem() const { slock l(_wr_mutex); return
_wmgr.get_aio_evt_rem(); }
+
+ inline u_int32_t get_rd_aio_evt_rem() const { return _rmgr.get_aio_evt_rem(); }
+
inline u_int32_t get_wr_outstanding_aio_dblks() const
{ return _wrfc.aio_outstanding_dblks(); }