summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-11-01 15:26:51 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-01 05:01:45 +0000
commitcf5960442da767eff8bd67ec2cc12cdff98fcb09 (patch)
tree1746cfad38390ad8f98976b7a45bba15e22ecea2
parent4645125b6cf7effd4788a543cf7f8acdc8fded13 (diff)
downloadmongo-cf5960442da767eff8bd67ec2cc12cdff98fcb09.tar.gz
Import wiredtiger: c01e34c7a23abf8b0da9a7ef1ee2a7c5cfc1b7ae from branch mongodb-6.0
ref: 13306c3517..c01e34c7a2 for: 6.0.3 WT-9926 Remove backup file after recovery checkpoint. (#8316) (#8428)
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_turtle.c7
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c9
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_recover.c3
4 files changed, 18 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 4fac76e4a9f..74d426258fc 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-6.0",
- "commit": "13306c3517a9731ad2cf580aca262c29a5a7895d"
+ "commit": "c01e34c7a23abf8b0da9a7ef1ee2a7c5cfc1b7ae"
}
diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c
index 41362018a3a..240ee1d5ea7 100644
--- a/src/third_party/wiredtiger/src/meta/meta_turtle.c
+++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c
@@ -539,8 +539,11 @@ err:
}
__wt_free(session, backuphash);
- /* Remove the backup files, we'll never read them again. */
- return (__wt_backup_file_remove(session));
+ /*
+ * We used to remove the backup file here. But we cannot do that until the metadata is fully
+ * synced to disk after recovery.
+ */
+ return (ret);
}
/*
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index cb4cebae43c..070670021ec 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -1363,6 +1363,15 @@ __checkpoint_lock_dirty_tree_int(WT_SESSION_IMPL *session, bool is_checkpoint, b
is_wt_ckpt = WT_PREFIX_MATCH(ckpt->name, WT_CHECKPOINT);
/*
+ * If we are restarting from a backup and we're in recovery do not delete any checkpoints.
+ * In the event of a crash we may need to restart from the backup and all checkpoints that
+ * were in the backup file must remain.
+ */
+ if (F_ISSET(conn, WT_CONN_RECOVERING) && F_ISSET(conn, WT_CONN_WAS_BACKUP)) {
+ F_CLR(ckpt, WT_CKPT_DELETE);
+ continue;
+ }
+ /*
* If there is a hot backup, don't delete any WiredTiger checkpoint that could possibly have
* been created before the backup started. Fail if trying to delete any other named
* checkpoint.
diff --git a/src/third_party/wiredtiger/src/txn/txn_recover.c b/src/third_party/wiredtiger/src/txn/txn_recover.c
index cd44986dac4..b738f7d0b20 100644
--- a/src/third_party/wiredtiger/src/txn/txn_recover.c
+++ b/src/third_party/wiredtiger/src/txn/txn_recover.c
@@ -1095,6 +1095,9 @@ done:
*/
WT_ERR(session->iface.checkpoint(&session->iface, "force=1"));
+ /* Remove any backup file now that metadata has been synced. */
+ WT_ERR(__wt_backup_file_remove(session));
+
/*
* Update the open dhandles write generations and base write generation with the connection's
* base write generation because the recovery checkpoint writes the pages to disk with new write