diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2015-10-23 03:56:20 +0000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2015-10-23 03:56:20 +0000 |
commit | 786f74888eb8adaf70331d5bfb4b464b321df8c0 (patch) | |
tree | 8270592bfc4bcb2a1be030635f5cc7bb5d81227e /src/txn/txn_ckpt.c | |
parent | be544dd08106699baa6cb459e5103471c3dd27ba (diff) | |
download | mongo-786f74888eb8adaf70331d5bfb4b464b321df8c0.tar.gz |
WT-2164 Have LSM enable metadata tracking prior to checkpointing a chunk.
Otherwise insufficient locks are held to keep checkpoint handles alive.
Also add assertions into checkpoint to avoid running into this again
in the future.
Diffstat (limited to 'src/txn/txn_ckpt.c')
-rw-r--r-- | src/txn/txn_ckpt.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index ccd6ce23560..b2847ee358f 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -726,8 +726,8 @@ __drop_to(WT_CKPT *ckptbase, const char *name, size_t len) * Checkpoint a tree. */ static int -__checkpoint_worker( - WT_SESSION_IMPL *session, const char *cfg[], bool is_checkpoint) +__checkpoint_worker(WT_SESSION_IMPL *session, + const char *cfg[], bool is_checkpoint, bool need_tracking) { WT_BM *bm; WT_BTREE *btree; @@ -753,6 +753,16 @@ __checkpoint_worker( name_alloc = NULL; /* + * Most callers need meta tracking to be on here, otherwise it is + * possible for this checkpoint to cleanup handles that are still in + * use. The exceptions are: + * - Checkpointing the metadata handle itself. + * - On connection close when we know there can't be any races. + */ + WT_ASSERT(session, !need_tracking || + WT_IS_METADATA(dhandle) || WT_META_TRACKING(session)); + + /* * Set the checkpoint LSN to the maximum LSN so that if logging is * disabled, recovery will never roll old changes forward over the * non-logged changes in this checkpoint. If logging is enabled, a @@ -1128,7 +1138,7 @@ __wt_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) /* Should be holding the schema lock. */ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA)); - return (__checkpoint_worker(session, cfg, true)); + return (__checkpoint_worker(session, cfg, true, true)); } /* @@ -1208,7 +1218,7 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, bool final) if (need_tracking) WT_RET(__wt_meta_track_on(session)); - WT_TRET(__checkpoint_worker(session, NULL, false)); + WT_TRET(__checkpoint_worker(session, NULL, false, need_tracking)); if (need_tracking) WT_RET(__wt_meta_track_off(session, true, ret != 0)); |