From 14faaa5492a64986ed8a8e9b235664f1fa7a4bc4 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Fri, 29 Oct 2010 16:58:59 +0000 Subject: 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 --- cpp/src/qpid/store/ms-clfs/TransactionLog.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/store/ms-clfs/TransactionLog.cpp') 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& 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& 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. -- cgit v1.2.1