diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-04-07 14:07:38 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-04-07 14:07:38 +1000 |
commit | c0446cf3b7a6fa0e596f103458e53ef7302b17d5 (patch) | |
tree | 4ea83da88c2ad2a20631a5076324f842a3518b34 /src/txn | |
parent | 466d74b84e7f347ee98074d8457b94420a8c5e95 (diff) | |
download | mongo-c0446cf3b7a6fa0e596f103458e53ef7302b17d5.tar.gz |
WT-2534 Use atomic add when allocating transaction IDs.
Diffstat (limited to 'src/txn')
-rw-r--r-- | src/txn/txn_ckpt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index fdbda26b781..27e18b254b8 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -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); |