From 01e822b1ae029636958e03ba89d2f5594243f3ca Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Thu, 25 Jun 2015 15:28:19 +1000 Subject: [PATCH] Revert "SERVER-18838 flush WT metadata during create/drop so we don't see missing files after a crash." This reverts commit 5c4878f7cfa3cdf13cd11025803e6c3305fc6c60. --- src/include/extern.h | 1 - src/meta/meta_table.c | 28 ---------------------------- src/meta/meta_track.c | 15 ++++++++++++++- src/schema/schema_drop.c | 3 --- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/include/extern.h b/src/include/extern.h index 82471e4cdb5..f399bd2b900 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -423,7 +423,6 @@ extern int __wt_ext_metadata_update(WT_EXTENSION_API *wt_api, WT_SESSION *wt_ses extern int __wt_metadata_get_ckptlist( WT_SESSION *session, const char *name, WT_CKPT **ckptbasep); extern void __wt_metadata_free_ckptlist(WT_SESSION *session, WT_CKPT *ckptbase); extern int __wt_metadata_open(WT_SESSION_IMPL *session); -extern int __wt_metadata_sync(WT_SESSION_IMPL *session); extern int __wt_metadata_cursor( WT_SESSION_IMPL *session, const char *config, WT_CURSOR **cursorp); extern int __wt_metadata_insert( WT_SESSION_IMPL *session, const char *key, const char *value); extern int __wt_metadata_update( WT_SESSION_IMPL *session, const char *key, const char *value); diff --git a/src/meta/meta_table.c b/src/meta/meta_table.c index adf447e8391..227d0fa9a6c 100644 --- a/src/meta/meta_table.c +++ b/src/meta/meta_table.c @@ -49,34 +49,6 @@ __wt_metadata_open(WT_SESSION_IMPL *session) return (__wt_session_release_btree(session)); } -/* - * __wt_metadata_sync -- - * Make the metadata durable, either by flushing the log or by - * checkpointing the metadata. - */ -int -__wt_metadata_sync(WT_SESSION_IMPL *session) -{ - WT_DECL_RET; - - /* If we're logging, make sure the metadata update was flushed. */ - if (FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED)) { - if (!FLD_ISSET(S2C(session)->txn_logsync, - WT_LOG_DSYNC | WT_LOG_FSYNC)) - WT_WITH_DHANDLE(session, session->meta_dhandle, - ret = __wt_txn_checkpoint_log(session, - 0, WT_TXN_LOG_CKPT_SYNC, NULL)); - } else { - WT_WITH_DHANDLE(session, session->meta_dhandle, - ret = __wt_checkpoint(session, NULL)); - WT_RET(ret); - WT_WITH_DHANDLE(session, session->meta_dhandle, - ret = __wt_checkpoint_sync(session, NULL)); - } - - return (ret); -} - /* * __wt_metadata_cursor -- * Opens a cursor on the metadata. diff --git a/src/meta/meta_track.c b/src/meta/meta_track.c index a0d0072074f..5e083d6df5e 100644 --- a/src/meta/meta_track.c +++ b/src/meta/meta_track.c @@ -255,7 +255,20 @@ __wt_meta_track_off(WT_SESSION_IMPL *session, int need_sync, int unroll) if (unroll || ret != 0 || !need_sync || session->meta_dhandle == NULL) return (ret); - WT_TRET(__wt_metadata_sync(session)); + /* If we're logging, make sure the metadata update was flushed. */ + if (FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED)) { + if (!FLD_ISSET(S2C(session)->txn_logsync, + WT_LOG_DSYNC | WT_LOG_FSYNC)) + WT_WITH_DHANDLE(session, session->meta_dhandle, + ret = __wt_txn_checkpoint_log(session, + 0, WT_TXN_LOG_CKPT_SYNC, NULL)); + } else { + WT_WITH_DHANDLE(session, session->meta_dhandle, + ret = __wt_checkpoint(session, NULL)); + WT_RET(ret); + WT_WITH_DHANDLE(session, session->meta_dhandle, + ret = __wt_checkpoint_sync(session, NULL)); + } return (ret); } diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c index 4071f481ecd..d5d8acd5321 100644 --- a/src/schema/schema_drop.c +++ b/src/schema/schema_drop.c @@ -38,9 +38,6 @@ __drop_file( if (!remove_files) return (ret); - /* Make sure the metadata is flushed before removing the file. */ - WT_TRET(__wt_metadata_sync(session)); - /* * Remove the underlying physical file. There is no point tracking this * operation: there is no going back from here.