Author: kpvdr
Date: 2008-07-30 16:09:46 -0400 (Wed, 30 Jul 2008)
New Revision: 2237
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
Log:
Fix for BDB txn error created in last checkin, also added txn to one addtional call
omitted on previouis fixes.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-07-30 18:32:51 UTC (rev 2236)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-07-30 20:09:46 UTC (rev 2237)
@@ -452,7 +452,7 @@
TxnCtxt txn;
txn.begin(env, true);
try {
- status = db.put(txn.get(), &key, &value, DB_NOOVERWRITE |
DB_AUTO_COMMIT);
+ status = db.put(txn.get(), &key, &value, DB_NOOVERWRITE);
txn.commit();
} catch (...) {
txn.abort();
@@ -1035,6 +1035,8 @@
checkInit();
u_int64_t messageId (msg->getPersistenceId());
if (messageId != 0) {
+ TxnCtxt txn;
+ txn.begin(env, true);
try {
Dbt key (&messageId, sizeof(messageId));
u_int64_t offset = getRecordSize(messageDb, key);
@@ -1050,9 +1052,14 @@
value.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
value.set_doff(offset);
value.set_dlen(size);
- messageDb.put(0, &key, &value, DB_AUTO_COMMIT);
+ messageDb.put(txn.get(), &key, &value, 0);
+ txn.commit();
} catch (const DbException& e) {
+ txn.abort();
THROW_STORE_EXCEPTION_2("Error appending content", e);
+ } catch (...) {
+ txn.abort();
+ throw;
}
} else {
THROW_STORE_EXCEPTION("Cannot append content. Message not known to
store!");
Show replies by date