Commit 864ef53b authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2811], add some comments

git-svn-id: file:///svn/toku/tokudb@26097 c7de825b-a66e-492c-adef-691d508d4ae1
parent d091aa6e
...@@ -241,6 +241,13 @@ void toku_rollback_txn_close (TOKUTXN txn) { ...@@ -241,6 +241,13 @@ void toku_rollback_txn_close (TOKUTXN txn) {
r = toku_omt_delete_at(txn->logger->live_root_txns, idx); r = toku_omt_delete_at(txn->logger->live_root_txns, idx);
assert(r==0); assert(r==0);
} }
//
// if this txn created a snapshot, make necessary modifications to list of snapshot txnids and live_list_reverse
// the order of operations is important. We first remove the txnid from the list of snapshot txnids. This is
// necessary because root snapshot transactions are in their own live lists. If we do not remove
// the txnid from the snapshot txnid list first, then when we go to make the modifications to
// live_list_reverse, we have trouble. We end up never removing (id, id) from live_list_reverse
//
if (txn->snapshot_type != TXN_SNAPSHOT_NONE && (txn->parent==NULL || txn->snapshot_type == TXN_SNAPSHOT_CHILD)) { if (txn->snapshot_type != TXN_SNAPSHOT_NONE && (txn->parent==NULL || txn->snapshot_type == TXN_SNAPSHOT_CHILD)) {
{ {
u_int32_t idx; u_int32_t idx;
......
...@@ -196,6 +196,21 @@ int toku_txn_begin_with_xid ( ...@@ -196,6 +196,21 @@ int toku_txn_begin_with_xid (
r = toku_omt_insert_at(logger->live_txns, result, toku_omt_size(logger->live_txns)); r = toku_omt_insert_at(logger->live_txns, result, toku_omt_size(logger->live_txns));
if (r!=0) goto died; if (r!=0) goto died;
//
// maintain the data structures necessary for MVCC:
// 1. add txn to list of live_root_txns if this is a root transaction
// 2. if the transaction is creating a snapshot:
// - create a live list for the transaction
// - add the id to the list of snapshot ids
// - make the necessary modifications to the live_list_reverse
//
// The order of operations is important here, and must be taken
// into account when the transaction is closed. The txn is added
// to the live_root_txns first (if it is a root txn). This has the implication
// that a root level snapshot transaction is in its own live list. This fact
// is taken into account when the transaction is closed.
//
// add ancestor information, and maintain global live root txn list // add ancestor information, and maintain global live root txn list
if (parent_tokutxn==NULL) { if (parent_tokutxn==NULL) {
//Add txn to list (omt) of live root txns //Add txn to list (omt) of live root txns
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment