summaryrefslogtreecommitdiff
path: root/src/txn
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-10-21 08:19:17 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-10-21 08:19:17 -0400
commit18800e7fc41a60ae247dc6049cd02332fd26b830 (patch)
treef576ea57bab46eb53c21fcf09f1981213ca9e5be /src/txn
parent3788fb71a021b3aca42162ecece6784b73eaf0c6 (diff)
downloadmongo-18800e7fc41a60ae247dc6049cd02332fd26b830.tar.gz
Don't separate the code to mark the root page dirty and subsequently
mark the tree clean with a call into the logging code, it's confusing. Merge __wt_cache_force_write() into the checkpoint-worker code (it's only called in one place and it's 2 lines of code).
Diffstat (limited to 'src/txn')
-rw-r--r--src/txn/txn_ckpt.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index aa2e0839b40..4603a6ebfca 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -806,23 +806,17 @@ __checkpoint_worker(
}
/*
- * Mark the root page dirty to ensure something gets written.
- *
- * Don't test the tree modify flag first: if the tree is modified,
- * we must write the root page anyway, we're not adding additional
- * writes to the process. If the tree is not modified, we have to
- * dirty the root page to ensure something gets written. This is
- * really about paranoia: if the tree modification value gets out of
- * sync with the set of dirty pages (modify is set, but there are no
- * dirty pages), we do a checkpoint without any writes, no checkpoint
- * is created, and then things get bad.
+ * Mark the root page dirty to ensure something gets written. (If the
+ * tree is modified, we must write the root page anyway, this doesn't
+ * add additional writes to the process. If the tree is not modified,
+ * we have to dirty the root page to ensure something gets written.)
+ * This is really about paranoia: if the tree modification value gets
+ * out of sync with the set of dirty pages (modify is set, but there
+ * are no dirty pages), we perform a checkpoint without any writes, no
+ * checkpoint is created, and then things get bad.
*/
- WT_ERR(__wt_cache_force_write(session));
-
- /* Tell logging that a file checkpoint is starting. */
- if (conn->logging)
- WT_ERR(__wt_txn_checkpoint_log(
- session, 0, WT_TXN_LOG_CKPT_START, &ckptlsn));
+ WT_ERR(__wt_page_modify_init(session, btree->root.page));
+ __wt_page_modify_set(session, btree->root.page);
/*
* Clear the tree's modified flag; any changes before we clear the flag
@@ -837,6 +831,11 @@ __checkpoint_worker(
btree->modified = 0;
WT_FULL_BARRIER();
+ /* Tell logging that a file checkpoint is starting. */
+ if (conn->logging)
+ WT_ERR(__wt_txn_checkpoint_log(
+ session, 0, WT_TXN_LOG_CKPT_START, &ckptlsn));
+
/* Flush the file from the cache, creating the checkpoint. */
if (is_checkpoint)
WT_ERR(__wt_cache_op(session, ckptbase, WT_SYNC_CHECKPOINT));