-
Type:
Task
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Live Restore
-
Storage Engines
-
StorEng - 2025-02-04, StorEng - 2025-02-28
-
1
To aid in diagnosing potential issues the WT util should be enhanced to work with partially live restored databases. I have a patch that implements this for the most part.
diff --git a/src/utilities/util_main.c b/src/utilities/util_main.c
index f41071e51..aa2993f81 100644
--- a/src/utilities/util_main.c
+++ b/src/utilities/util_main.c
@@ -83,7 +83,7 @@ main(int argc, char *argv[])
size_t len;
int ch, major_v, minor_v, tret, (*func)(WT_SESSION *, int, char *[]);
char *p, *secretkey;
- const char *cmd_config, *conn_config, *p1, *p2, *p3, *readonly_config, *rec_config,
+ const char *cmd_config, *conn_config, *live_restore_path, *p1, *p2, *p3, *readonly_config, *rec_config,
*salvage_config, *session_config;
bool backward_compatible, disable_prefetch, logoff, meta_verify, readonly, recover, salvage;
@@ -106,7 +106,7 @@ main(int argc, char *argv[])
return (EXIT_FAILURE);
}
- cmd_config = conn_config = readonly_config = salvage_config = session_config = secretkey = NULL;
+ cmd_config = conn_config = live_restore_path = readonly_config = salvage_config = session_config = secretkey = NULL;
/*
* We default to returning an error if recovery needs to be run. Generally we expect this to be
* run after a clean shutdown. The printlog command disables logging entirely. If recovery is
@@ -117,7 +117,7 @@ main(int argc, char *argv[])
false;
/* Check for standard options. */
__wt_optwt = 1; /* enable WT-specific behavior */
- while ((ch = __wt_getopt(progname, argc, argv, "BC:E:h:LmpRrSVv?")) != EOF)
+ while ((ch = __wt_getopt(progname, argc, argv, "BC:E:h:l:LmpRrSVv?")) != EOF)
switch (ch) {
case 'B': /* backward compatibility */
backward_compatible = true;
@@ -142,6 +142,9 @@ main(int argc, char *argv[])
rec_config = REC_LOGOFF;
logoff = true;
break;
+ case 'l':
+ live_restore_path = __wt_optarg;
+ break;
case 'm': /* verify metadata on connection open */
cmd_config = "verify_metadata=true";
meta_verify = true;
@@ -290,6 +293,11 @@ open:
len += strlen(conn_config);
if (cmd_config != NULL)
len += strlen(cmd_config);
+ len += strlen("live_restore=(enabled=,threads_max=0,path=)");
+ if (live_restore_path != NULL)
+ len += strlen(live_restore_path) + strlen("true");
+ else
+ len += strlen("false");
if (readonly_config != NULL)
len += strlen(readonly_config);
if (salvage_config != NULL)
@@ -305,8 +313,8 @@ open:
(void)util_err(NULL, errno, NULL);
goto err;
}
- if ((ret = __wt_snprintf(p, len, "error_prefix=wt,%s,%s,%s,%s,%s%s%s%s",
- conn_config == NULL ? "" : conn_config, cmd_config == NULL ? "" : cmd_config,
+ if ((ret = __wt_snprintf(p, len, "error_prefix=wt,%s,%s,live_restore=(enabled=%s,threads_max=0,path=%s),%s,%s,%s%s%s%s",
+ conn_config == NULL ? "" : conn_config, cmd_config == NULL ? "" : cmd_config, live_restore_path == NULL ? "false" : "true", live_restore_path == NULL ? "" : live_restore_path,
readonly_config == NULL ? "" : readonly_config, rec_config,
salvage_config == NULL ? "" : salvage_config, p1, p2, p3)) != 0) {
(void)util_err(NULL, ret, NULL);
The difficult part of this change will be testing that it works as expected. Additionally a threads_max of 0 should be passed to avoid the background threads operating.