summaryrefslogtreecommitdiff
path: root/src/lsm
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2017-04-19 00:34:45 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2017-04-19 14:34:45 +1000
commitf8db6cf5707ee44b7906f00add610b705d696dc6 (patch)
tree122db8070a7cb1de385f51ec520d5ae794326891 /src/lsm
parent35e221c039a0931af5b3a18069e57ba9a218aead (diff)
downloadmongo-f8db6cf5707ee44b7906f00add610b705d696dc6.tar.gz
WT-3292 review/cleanup full-barrier calls in WiredTiger (#3395)
* Rework logging's log_close_fh and log_close_lsn barrier code. There are two fields, the close handle and the close LSN, and they both have to be set. The __log_file_server() code was checking the close handle and then spinning until the close LSN was set, but a simpler solution is to publish the close LSN write before setting the close handle. To be clear, the previous code was correct, it was the comment that was wrong. * Remove barriers from around read/write of WT_TXN_GLOBAL.checkpoint_running. The read-barrier in __compact_checkpoint() isn't needed because the check is on memory declared volatile. The full-barrier in __txn_checkpoint_wrapper isn't needed because there's no ordering constraint. * Don't flush the reset of the WT_REF.state field, we've never seen any performance reason that a barrier is needed. * Fix a comment: technically, the las-was-written flag has to be flushed before any relevant read happens, document it that way. * Instead of explicitly flushing the clear of the WT_CONN_SERVER_LSM flag, change __wt_sleep() to imply a barrier, there are loops which don't have no other barriers, like __lsm_manager_run_server().
Diffstat (limited to 'src/lsm')
-rw-r--r--src/lsm/lsm_manager.c6
-rw-r--r--src/lsm/lsm_tree.c4
2 files changed, 3 insertions, 7 deletions
diff --git a/src/lsm/lsm_manager.c b/src/lsm/lsm_manager.c
index 88b3e1980be..f391c553d2a 100644
--- a/src/lsm/lsm_manager.c
+++ b/src/lsm/lsm_manager.c
@@ -284,12 +284,8 @@ __wt_lsm_manager_destroy(WT_SESSION_IMPL *session)
manager = &conn->lsm_manager;
removed = 0;
- /*
- * Clear the LSM server flag and flush to ensure running threads see
- * the state change.
- */
+ /* Clear the LSM server flag. */
F_CLR(conn, WT_CONN_SERVER_LSM);
- WT_FULL_BARRIER();
WT_ASSERT(session, !F_ISSET(conn, WT_CONN_READONLY) ||
manager->lsm_workers == 0);
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index fb8eb9d38a7..fe36237969f 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -768,13 +768,13 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_ERR(__wt_lsm_meta_write(session, lsm_tree, NULL));
lsm_tree->need_switch = false;
- ++lsm_tree->dsk_gen;
-
lsm_tree->modified = true;
+
/*
* Ensure the updated disk generation is visible to all other threads
* before updating the transaction ID.
*/
+ ++lsm_tree->dsk_gen;
WT_FULL_BARRIER();
/*