summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/meta/meta_turtle.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-02-19 15:36:42 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2016-02-19 15:36:47 +1100
commit70db6ed51f90f627570de9bf32ab8c5cd23886ca (patch)
tree1f5ae19d38fad8488657ae80ae9014b832ec858e /src/third_party/wiredtiger/src/meta/meta_turtle.c
parentda2441b59b742c077306be6515c999c33cd955a6 (diff)
downloadmongo-70db6ed51f90f627570de9bf32ab8c5cd23886ca.tar.gz
Import wiredtiger-wiredtiger-2.7.0-675-g4f38287.tar.gz from wiredtiger branch mongodb-3.4
ref: cc96d99..4f38287 SERVER-22676 WiredTiger fails to open databases created by 3.0.0 or 3.0.1 WT-2280 Add CRC32 Optimized code for PPC64LE WT-2295 WT_SESSION.create does a full-scan of the main table WT-2346 Don't hold schema lock during checkpoint I/O WT-2361 Column-store starting record number error WT-2367 WT_CURSOR.next out-of-order returns failure WT-2374 Read error on index file WT-2375 Need tests for collators WT-2382 Problem with custom collator for 'u' format with join cursor WT-2387 Fix cursor random unit test on Windows WT-2390 OS X build is broken WT-2393 Unnecessary error handling labels. WT-2396 Jenkins Spinlock GCC task Hung WT-2397 Cursor traversal from end of the tree skips records. WT-2399 Add test case that verifies cursor traversal WT-2411 LSM drop hang
Diffstat (limited to 'src/third_party/wiredtiger/src/meta/meta_turtle.c')
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_turtle.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c
index 7182bb0fe5f..3d27f0b5845 100644
--- a/src/third_party/wiredtiger/src/meta/meta_turtle.c
+++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c
@@ -153,10 +153,11 @@ int
__wt_turtle_init(WT_SESSION_IMPL *session)
{
WT_DECL_RET;
- bool exist, exist_incr;
+ bool exist_backup, exist_incr, exist_turtle, load;
char *metaconf;
metaconf = NULL;
+ load = false;
/*
* Discard any turtle setup file left-over from previous runs. This
@@ -179,13 +180,29 @@ __wt_turtle_init(WT_SESSION_IMPL *session)
* done.
*/
WT_RET(__wt_exist(session, WT_INCREMENTAL_BACKUP, &exist_incr));
- WT_RET(__wt_exist(session, WT_METADATA_TURTLE, &exist));
- if (exist) {
+ WT_RET(__wt_exist(session, WT_METADATA_BACKUP, &exist_backup));
+ WT_RET(__wt_exist(session, WT_METADATA_TURTLE, &exist_turtle));
+ if (exist_turtle) {
if (exist_incr)
WT_RET_MSG(session, EINVAL,
"Incremental backup after running recovery "
"is not allowed.");
- } else {
+ /*
+ * If we have a backup file and metadata and turtle files,
+ * we want to recreate the metadata from the backup.
+ */
+ if (exist_backup) {
+ WT_RET(__wt_msg(session, "Both %s and %s exist. "
+ "Recreating metadata from backup.",
+ WT_METADATA_TURTLE, WT_METADATA_BACKUP));
+ WT_RET(__wt_remove_if_exists(session, WT_METAFILE));
+ WT_RET(__wt_remove_if_exists(
+ session, WT_METADATA_TURTLE));
+ load = true;
+ }
+ } else
+ load = true;
+ if (load) {
if (exist_incr)
F_SET(S2C(session), WT_CONN_WAS_BACKUP);