Skip to content

Commit

Permalink
Import wiredtiger-wiredtiger-2.8.0-137-g94c171d.tar.gz from wiredtige…
Browse files Browse the repository at this point in the history
…r branch mongodb-3.4

ref: 5047aab..94c171d

WT-2534       Invalid transaction snapshots on PowerPC
SERVER-23517  WiredTiger changes for MongoDB 3.3.5
  • Loading branch information
michaelcahill committed Apr 7, 2016
1 parent af5080d commit 2817009
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/third_party/wiredtiger/src/include/txn.i
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,13 @@ __wt_txn_id_alloc(WT_SESSION_IMPL *session, bool publish)
WT_PUBLISH(WT_SESSION_TXN_STATE(session)->id, id);
}

++txn_global->current;
__wt_spin_unlock(session, &txn_global->id_lock);
/*
* Even though we are in a spinlock, readers are not. We rely on
* atomic reads of the current ID to create snapshots, so for unlocked
* reads to be well defined, we must use an atomic increment here.
*/
(void)__wt_atomic_addv64(&txn_global->current, 1);
__wt_spin_unlock(session, &txn_global->id_lock);
return (id);
}

Expand Down
7 changes: 4 additions & 3 deletions src/third_party/wiredtiger/src/txn/txn_ckpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,15 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* Start the checkpoint for real.
*
* Bump the global checkpoint generation, used to figure out whether
* checkpoint has visited a tree. There is no need for this to be
* atomic: it is only written while holding the checkpoint lock.
* checkpoint has visited a tree. Use an atomic increment even though
* we are single-threaded because readers of the checkpoint generation
* don't hold the checkpoint lock.
*
* We do need to update it before clearing the checkpoint's entry out
* of the transaction table, or a thread evicting in a tree could
* ignore the checkpoint's transaction.
*/
++txn_global->checkpoint_gen;
(void)__wt_atomic_addv64(&txn_global->checkpoint_gen, 1);
WT_STAT_FAST_CONN_SET(session,
txn_checkpoint_generation, txn_global->checkpoint_gen);

Expand Down

0 comments on commit 2817009

Please sign in to comment.