summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-03-18 14:28:45 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2016-03-18 14:28:45 +1100
commit558672a31ded61187599dbf545a4e9f42ba0dd37 (patch)
tree58503c12789be51965cda7d9b617b3dd393877a3
parentfd9840f0e9d4b132675d1ea318c930dafb989c68 (diff)
downloadmongo-558672a31ded61187599dbf545a4e9f42ba0dd37.tar.gz
WT-2496 Fix a race between checkpoint and starting a hot backup.
In particular, a checkpoint could mark and lock an old checkpoint for deletion before a hotbackup starts. The hotbackup could then write metadata referencing that old backup which the checkpoint goes on to delete. The fix is crude: don't allow a hotbackup to start while a checkpoint is in progress.
-rw-r--r--src/cursor/cur_backup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c
index b097a8c08aa..2fb0c464a76 100644
--- a/src/cursor/cur_backup.c
+++ b/src/cursor/cur_backup.c
@@ -140,8 +140,9 @@ __wt_curbackup_open(WT_SESSION_IMPL *session,
* Start the backup and fill in the cursor's list. Acquire the schema
* lock, we need a consistent view when creating a copy.
*/
- WT_WITH_SCHEMA_LOCK(session, ret,
- ret = __backup_start(session, cb, cfg));
+ WT_WITH_CHECKPOINT_LOCK(session, ret,
+ WT_WITH_SCHEMA_LOCK(session, ret,
+ ret = __backup_start(session, cb, cfg)));
WT_ERR(ret);
/* __wt_cursor_init is last so we don't have to clean up on error. */