summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/store/ms-clfs/TransactionLog.cpp
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2010-10-29 16:58:59 +0000
committerStephen D. Huston <shuston@apache.org>2010-10-29 16:58:59 +0000
commit14faaa5492a64986ed8a8e9b235664f1fa7a4bc4 (patch)
tree2aa6111da1d2e9ab9be352a5e7335865477f7c29 /cpp/src/qpid/store/ms-clfs/TransactionLog.cpp
parentb9294d9f4221250793d1c9db352450fc773143a7 (diff)
downloadqpid-python-14faaa5492a64986ed8a8e9b235664f1fa7a4bc4.tar.gz
Since LSNs are used as persistence IDs and ID 0 usually means "not persisted", ensure that no log record that's used gets written at LSN 0.
Add stub for loadContent(). Correct transaction references in enqueue/dequeue. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1028840 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/store/ms-clfs/TransactionLog.cpp')
-rw-r--r--cpp/src/qpid/store/ms-clfs/TransactionLog.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/cpp/src/qpid/store/ms-clfs/TransactionLog.cpp b/cpp/src/qpid/store/ms-clfs/TransactionLog.cpp
index 937641405c..04780e83e8 100644
--- a/cpp/src/qpid/store/ms-clfs/TransactionLog.cpp
+++ b/cpp/src/qpid/store/ms-clfs/TransactionLog.cpp
@@ -99,6 +99,16 @@ namespace qpid {
namespace store {
namespace ms_clfs {
+void
+TransactionLog::initialize()
+{
+ // Write something to occupy the first record, preventing a real
+ // transaction from being lsn/id 0. Delete of a non-existant id is easily
+ // tossed during recovery if no other transactions have caused the tail
+ // to be moved up past this dummy record by then.
+ deleteTransaction(0);
+}
+
uint32_t
TransactionLog::marshallingBufferSize()
{
@@ -226,7 +236,6 @@ TransactionLog::deleteTransaction(uint64_t transId)
write(&deleteEntry, sizeof(deleteEntry), &transLsn);
if (newFirstId != 0)
moveTail(idToLsn(newFirstId));
-
}
void
@@ -252,6 +261,8 @@ TransactionLog::collectPreparedXids(std::map<std::string, TPCTransaction::shared
void
TransactionLog::recover(std::map<uint64_t, Transaction::shared_ptr>& transMap)
{
+ QPID_LOG(debug, "Recovering transaction log");
+
// Note that there may be transaction refs in the log which are deleted,
// so be sure to only add transactions at Start records, and ignore those
// that don't have an existing message record.
@@ -378,6 +389,8 @@ TransactionLog::recover(std::map<uint64_t, Transaction::shared_ptr>& transMap)
if (status != ERROR_HANDLE_EOF) // No more records
throw QPID_WINDOWS_ERROR(status);
+ QPID_LOG(debug, "Transaction log recovered");
+
// At this point we have a list of all the not-deleted transactions that
// were in existence when the broker last ran. All transactions of both
// Dtx and Tx types that haven't prepared or committed will be aborted.