diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2015-05-11 15:49:26 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2015-05-11 15:49:26 -0400 |
commit | 1880ed81fe765aed24f7e328388ec739dd1ee3e3 (patch) | |
tree | 35d15063f849044cdb20bbb31037b4bb2f53cced | |
parent | c5a4a86438d08616e8ed8314e2dc5b64d7e186c7 (diff) | |
download | mongo-1880ed81fe765aed24f7e328388ec739dd1ee3e3.tar.gz |
Sync the metadata file before updating turtle file. SERVER-18316
-rw-r--r-- | src/txn/txn_ckpt.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index 8e2e55c5424..37ed48e8b96 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -504,11 +504,6 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) session->meta_dhandle, ret = __wt_checkpoint(session, cfg)); session->meta_track_next = saved_meta_next; WT_ERR(ret); - if (F_ISSET(conn, WT_CONN_CKPT_SYNC)) { - WT_WITH_DHANDLE(session, session->meta_dhandle, - ret = __wt_checkpoint_sync(session, NULL)); - WT_ERR(ret); - } WT_ERR(__checkpoint_verbose_track(session, "metadata sync completed", &verb_timer)); @@ -998,7 +993,16 @@ fake: /* if (fake_ckpt && FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED)) WT_INIT_LSN(&ckptlsn); - /* Update the object's metadata. */ + /* + * Update the object's metadata. + * + * If the object is the metadata, the call to __wt_meta_ckptlist_set + * will update the turtle file. We need to make sure the metadata is + * on disk before the turtle file is changed. + */ + if (F_ISSET(conn, WT_CONN_CKPT_SYNC) && + strcmp(dhandle->name, WT_METAFILE_URI) == 0) + WT_ERR(__wt_checkpoint_sync(session, NULL)); WT_ERR(__wt_meta_ckptlist_set( session, dhandle->name, ckptbase, &ckptlsn)); |