summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-05-14 11:51:09 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-05-14 15:32:18 +1000
commitac898d41d66d4916c2ba7b33432210c06a41244a (patch)
tree0c10e25865127518f63c60c42f3c44c5c6753683
parentc875603867b0a2d069361e5812ccc31a2ed70216 (diff)
downloadmongo-ac898d41d66d4916c2ba7b33432210c06a41244a.tar.gz
If we're closing a dirty tree in order to verify it (or any other exclusive operation), make sure the changes are stable on disk in case there is a crash.
refs SERVER-18316
-rw-r--r--src/txn/txn_ckpt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index 46f7d2d4db2..4bbc24dee43 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -1009,8 +1009,16 @@ fake: /*
* will update the turtle file and swap the new one into place. We
* need to make sure the metadata is on disk before the turtle file is
* updated.
+ *
+ * Also, if we are doing a checkpoint in a file without a transaction
+ * (such as closing a dirty tree before an exclusive operation such as
+ * verify), the metadata update will be auto-committed, so we need to
+ * sync the file first, or we could roll forward the metadata in
+ * recovery and try to open a checkpoint that isn'tyet durable.
*/
- if (F_ISSET(conn, WT_CONN_CKPT_SYNC) && WT_IS_METADATA(dhandle))
+ if (F_ISSET(conn, WT_CONN_CKPT_SYNC) &&
+ (WT_IS_METADATA(dhandle) ||
+ !F_ISSET(&session->txn, WT_TXN_RUNNING)))
WT_ERR(__wt_checkpoint_sync(session, NULL));
WT_ERR(__wt_meta_ckptlist_set(