summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/txn/txn_ckpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/txn/txn_ckpt.c')
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index 250ff740765..dba739792a2 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -1949,6 +1949,16 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, bool final)
return (__wt_set_return(session, EBUSY));
/*
+ * Make sure there isn't a potential race between backup copying the metadata and a checkpoint
+ * changing the metadata. Backup holds both the checkpoint and schema locks. Checkpoint should
+ * hold those also except on the final checkpoint during close. Confirm the caller either is the
+ * final checkpoint or holds at least one of the locks.
+ */
+ WT_ASSERT(session,
+ final ||
+ (FLD_ISSET(session->lock_flags, WT_SESSION_LOCKED_CHECKPOINT) ||
+ FLD_ISSET(session->lock_flags, WT_SESSION_LOCKED_SCHEMA)));
+ /*
* Turn on metadata tracking if:
* - The session is not already doing metadata tracking.
* - The file was not bulk loaded.