Author: kpvdr
Date: 2010-07-20 14:30:33 -0400 (Tue, 20 Jul 2010)
New Revision: 4134
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
Log:
Bug 614944 - "qpidd broker crash in mrg::msgstore::TxnCtxt::abort() ->
DbTxn::abort()": Fix part 2, in which the store will give BDB 3 chances to
sucessfully start. If a failure is caught, then it will wait 1 sec, then try again. If the
third attempt fails, the exception will be allowed to be thrown. All attempts are logged.
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-07-20 17:07:24 UTC (rev 4133)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-07-20 18:30:33 UTC (rev 4134)
@@ -306,6 +306,16 @@
void MessageStoreImpl::init()
{
+ const int retryMax = 3;
+ int bdbRetryCnt = 0;
+ do {
+ if (bdbRetryCnt++ > 0)
+ {
+ closeDbs();
+ ::usleep(1000000); // 1 sec delay
+ QPID_LOG(error, "Previoius BDB store initialization failed, retrying
(" << bdbRetryCnt << " of " << retryMax <<
")...");
+ }
+
try {
journal::jdir::create_dir(getBdbBaseDir());
@@ -353,6 +363,7 @@
"db_upgrade or using db_recover - but the
db4-utils package must also be installed to use these utilities.)", e);
}
QPID_LOG(error, "BDB exception occurred while initializing store: "
<< e.what());
+ if (bdbRetryCnt >= retryMax)
THROW_STORE_EXCEPTION_2("BDB exception occurred while initializing
store", e);
} catch (const journal::jexception& e) {
QPID_LOG(error, "Journal Exception occurred while initializing store:
" << e);
@@ -361,6 +372,7 @@
QPID_LOG(error, "Unknown exception occurred while initializing
store.");
throw;
}
+ } while (!isInit);
}
void MessageStoreImpl::finalize()
Show replies by date