Skip to content

Commit fc98392

Browse files
wt-vendoring-bot[bot]MongoDB Bot
authored andcommitted
Import wiredtiger: 3d7a2ba43c5217e93a318a319a9000f3c94a5c19 from branch mongodb-master (#31956)
GitOrigin-RevId: e2e9591
1 parent 1932f01 commit fc98392

File tree

10 files changed

+310
-144
lines changed

10 files changed

+310
-144
lines changed

src/third_party/wiredtiger/import.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"vendor": "wiredtiger",
33
"github": "wiredtiger/wiredtiger",
44
"branch": "mongodb-master",
5-
"commit": "9e998c004bc85d7d97974a1d4c945194f3eecb99"
5+
"commit": "3d7a2ba43c5217e93a318a319a9000f3c94a5c19"
66
}

src/third_party/wiredtiger/src/docs/command-line.dox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Specify an encryption secret key for the ::wiredtiger_open function.
2222
Specify a database home directory.
2323
@par \c -L
2424
Forcibly turn off logging subsystem for debugging purposes.
25+
@par \c -l directory
26+
Open a database that is in the process of being live restored. This parameter takes the path to the source directory as an argument.
2527
@par \c -m
2628
Verify the WiredTiger metadata as part of opening the database.
2729
@par \c -R

src/third_party/wiredtiger/src/utilities/util_main.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ usage(void)
4646
{
4747
static const char *options[] = {"-B", "maintain release 3.3 log file compatibility",
4848
"-C config", "wiredtiger_open configuration", "-E key", "secret encryption key", "-h home",
49-
"database directory", "-L", "turn logging off for debug-mode", "-m", "run verify on metadata",
50-
"-p",
49+
"database directory", "-L", "turn logging off for debug-mode", "-l",
50+
"run live restore using the path specified.", "-m", "run verify on metadata", "-p",
5151
"disable pre-fetching on the connection (use this option when dumping/verifying corrupted "
5252
"data)",
5353
"-R", "run recovery (if recovery configured)", "-r",
@@ -83,8 +83,8 @@ main(int argc, char *argv[])
8383
size_t len;
8484
int ch, major_v, minor_v, tret, (*func)(WT_SESSION *, int, char *[]);
8585
char *p, *secretkey;
86-
const char *cmd_config, *conn_config, *p1, *p2, *p3, *readonly_config, *rec_config,
87-
*salvage_config, *session_config;
86+
const char *cmd_config, *conn_config, *live_restore_path, *p1, *p2, *p3, *readonly_config,
87+
*rec_config, *salvage_config, *session_config;
8888
bool backward_compatible, disable_prefetch, logoff, meta_verify, readonly, recover, salvage;
8989

9090
conn = NULL;
@@ -106,7 +106,8 @@ main(int argc, char *argv[])
106106
return (EXIT_FAILURE);
107107
}
108108

109-
cmd_config = conn_config = readonly_config = salvage_config = session_config = secretkey = NULL;
109+
cmd_config = conn_config = live_restore_path = readonly_config = salvage_config =
110+
session_config = secretkey = NULL;
110111
/*
111112
* We default to returning an error if recovery needs to be run. Generally we expect this to be
112113
* run after a clean shutdown. The printlog command disables logging entirely. If recovery is
@@ -117,7 +118,7 @@ main(int argc, char *argv[])
117118
false;
118119
/* Check for standard options. */
119120
__wt_optwt = 1; /* enable WT-specific behavior */
120-
while ((ch = __wt_getopt(progname, argc, argv, "BC:E:h:LmpRrSVv?")) != EOF)
121+
while ((ch = __wt_getopt(progname, argc, argv, "BC:E:h:l:LmpRrSVv?")) != EOF)
121122
switch (ch) {
122123
case 'B': /* backward compatibility */
123124
backward_compatible = true;
@@ -142,6 +143,9 @@ main(int argc, char *argv[])
142143
rec_config = REC_LOGOFF;
143144
logoff = true;
144145
break;
146+
case 'l':
147+
live_restore_path = __wt_optarg;
148+
break;
145149
case 'm': /* verify metadata on connection open */
146150
cmd_config = "verify_metadata=true";
147151
meta_verify = true;
@@ -290,6 +294,11 @@ main(int argc, char *argv[])
290294
len += strlen(conn_config);
291295
if (cmd_config != NULL)
292296
len += strlen(cmd_config);
297+
len += strlen("live_restore=(enabled=,threads_max=0,path=)");
298+
if (live_restore_path != NULL)
299+
len += strlen(live_restore_path) + strlen("true");
300+
else
301+
len += strlen("false");
293302
if (readonly_config != NULL)
294303
len += strlen(readonly_config);
295304
if (salvage_config != NULL)
@@ -305,8 +314,11 @@ main(int argc, char *argv[])
305314
(void)util_err(NULL, errno, NULL);
306315
goto err;
307316
}
308-
if ((ret = __wt_snprintf(p, len, "error_prefix=wt,%s,%s,%s,%s,%s%s%s%s",
317+
if ((ret = __wt_snprintf(p, len,
318+
"error_prefix=wt,%s,%s,live_restore=(enabled=%s,threads_max=0,path=%s),%s,%s,%s%s%s%s",
309319
conn_config == NULL ? "" : conn_config, cmd_config == NULL ? "" : cmd_config,
320+
live_restore_path == NULL ? "false" : "true",
321+
live_restore_path == NULL ? "" : live_restore_path,
310322
readonly_config == NULL ? "" : readonly_config, rec_config,
311323
salvage_config == NULL ? "" : salvage_config, p1, p2, p3)) != 0) {
312324
(void)util_err(NULL, ret, NULL);

src/third_party/wiredtiger/test/format/backup.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,29 @@
3333
* Confirm the backup worked.
3434
*/
3535
static void
36-
check_copy(uint64_t id)
36+
check_copy(WT_SESSION *session, uint64_t id)
3737
{
3838
WT_CONNECTION *conn;
3939
char from_path[MAX_FORMAT_PATH], to_path[MAX_FORMAT_PATH];
4040

4141
/* Create the empty check directory. */
4242
testutil_create_backup_directory(g.home, id, true);
43-
testutil_snprintf(from_path, sizeof(from_path), "%s/BACKUP", g.home);
4443
testutil_snprintf(to_path, sizeof(to_path), "%s/CHECK.%" PRIu64, g.home, id);
45-
testutil_copy(from_path, to_path);
44+
if (!GV(BACKUP_LIVE_RESTORE)) {
45+
testutil_snprintf(from_path, sizeof(from_path), "%s/BACKUP", g.home);
46+
testutil_copy(from_path, to_path);
47+
}
4648

4749
/* Now setup and open the path for real. */
50+
g.backup_verify = true;
4851
wts_open(to_path, &conn, false);
52+
g.backup_verify = false;
4953

5054
/* Verify the objects. */
55+
trace_msg(session, "Start %s backup verify in %s",
56+
GV(BACKUP_LIVE_RESTORE) ? "live restore" : "copied", to_path);
5157
wts_verify(conn, true);
58+
trace_msg(session, "Completed backup verify in %s", to_path);
5259

5360
wts_close(&conn);
5461
/* If successful, remove the check directory. */
@@ -614,7 +621,7 @@ backup(void *arg)
614621
incremental = mmrand(&g.extra_rnd, 1, 8);
615622
}
616623
/* Checking is done in a separate directory so we can check every iteration. */
617-
check_copy(g.backup_id);
624+
check_copy(session, g.backup_id);
618625
if (--incremental == 0)
619626
/* Periodically restart with a full backup. */
620627
incr_full = full = true;

0 commit comments

Comments
 (0)