summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/utilities
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2021-01-25 10:17:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-25 11:01:39 +0000
commit62c3f69e2b2d2e805bb609edce01736f8ffa389b (patch)
tree314ef6ba4b2e51631d4d189207fca355eda49d27 /src/third_party/wiredtiger/src/utilities
parent4a262f6844b3a054f4d89c8d7dc802e263dbdfc1 (diff)
downloadmongo-62c3f69e2b2d2e805bb609edce01736f8ffa389b.tar.gz
Import wiredtiger: e39ffb554160de902060cd063c4b1547ff6d5e1e from branch mongodb-5.0
ref: 1e9c8aed12..e39ffb5541 for: 4.9.0 WT-6309 Add support for start/stop arguments to wt printlog command WT-6866 Refactor python backup tests initial base class WT-6946 Adding test tags to an initial set of test programs WT-7084 Fix assert in test code and a comment error WT-7109 Retain no longer supported configuration options for backward compatibility WT-7113 Integrate prototype tiered storage code into WT WT-7114 Revert Makefile code to always run the prototype script
Diffstat (limited to 'src/third_party/wiredtiger/src/utilities')
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_list.c33
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_load.c5
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_printlog.c37
3 files changed, 55 insertions, 20 deletions
diff --git a/src/third_party/wiredtiger/src/utilities/util_list.c b/src/third_party/wiredtiger/src/utilities/util_list.c
index ab2e6ad1299..13a3577745f 100644
--- a/src/third_party/wiredtiger/src/utilities/util_list.c
+++ b/src/third_party/wiredtiger/src/utilities/util_list.c
@@ -8,7 +8,7 @@
#include "util.h"
-static int list_get_allocsize(WT_SESSION *, const char *, size_t *);
+static int list_init_block(WT_SESSION *, const char *, WT_BLOCK *);
static int list_print(WT_SESSION *, const char *, bool, bool);
static int list_print_checkpoint(WT_SESSION *, const char *);
@@ -67,20 +67,20 @@ util_list(WT_SESSION *session, int argc, char *argv[])
}
/*
- * list_get_allocsize --
- * Get the allocation size for this file from the metadata.
+ * list_init_block --
+ * Initialize a dummy block structure for a file.
*/
static int
-list_get_allocsize(WT_SESSION *session, const char *key, size_t *allocsize)
+list_init_block(WT_SESSION *session, const char *key, WT_BLOCK *block)
{
- WT_CONFIG_ITEM szvalue;
+ WT_CONFIG_ITEM cval;
WT_CONFIG_PARSER *parser;
WT_DECL_RET;
WT_EXTENSION_API *wt_api;
int tret;
char *config;
- *allocsize = 0;
+ WT_CLEAR(*block);
parser = NULL;
config = NULL;
@@ -90,10 +90,14 @@ list_get_allocsize(WT_SESSION *session, const char *key, size_t *allocsize)
WT_ERR(util_err(session, ret, "%s: WT_EXTENSION_API.metadata_search", key));
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
WT_ERR(util_err(session, ret, "WT_EXTENSION_API.config_parser_open"));
- if ((ret = parser->get(parser, "allocation_size", &szvalue)) == 0)
- *allocsize = (size_t)szvalue.val;
- else
- ret = ret == WT_NOTFOUND ? 0 : util_err(session, ret, "WT_CONFIG_PARSER.get");
+ if ((ret = parser->get(parser, "allocation_size", &cval)) == 0)
+ block->allocsize = (uint32_t)cval.val;
+ else if (ret != WT_NOTFOUND)
+ WT_ERR(util_err(session, ret, "WT_CONFIG_PARSER.get"));
+
+ if ((ret = parser->get(parser, "block_allocation", &cval)) == 0)
+ block->log_structured = WT_STRING_MATCH("log_structured", cval.str, cval.len);
+
err:
if (parser != NULL && (tret = parser->close(parser)) != 0) {
tret = util_err(session, tret, "WT_CONFIG_PARSER.close");
@@ -202,10 +206,11 @@ list_print_size(uint64_t v)
static int
list_print_checkpoint(WT_SESSION *session, const char *key)
{
+ WT_BLOCK _block, *block;
WT_BLOCK_CKPT ci;
WT_CKPT *ckpt, *ckptbase;
WT_DECL_RET;
- size_t allocsize, len;
+ size_t len;
time_t t;
/*
@@ -217,7 +222,9 @@ list_print_checkpoint(WT_SESSION *session, const char *key)
return (ret == WT_NOTFOUND ? 0 : ret);
/* We need the allocation size for decoding the checkpoint addr */
- if ((ret = list_get_allocsize(session, key, &allocsize)) != 0)
+ /* TODO this is a kludge: fix */
+ block = &_block;
+ if ((ret = list_init_block(session, key, block)) != 0)
return (ret);
/* Find the longest name, so we can pretty-print. */
@@ -245,7 +252,7 @@ list_print_checkpoint(WT_SESSION *session, const char *key)
/* Decode the checkpoint block. */
if (ckpt->raw.data == NULL)
continue;
- if ((ret = __wt_block_ckpt_decode(session, allocsize, ckpt->raw.data, &ci)) == 0) {
+ if ((ret = __wt_block_ckpt_decode(session, block, ckpt->raw.data, &ci)) == 0) {
printf(
"\t\t"
"file-size: ");
diff --git a/src/third_party/wiredtiger/src/utilities/util_load.c b/src/third_party/wiredtiger/src/utilities/util_load.c
index 3aeb00c2e8b..0e9bd922eeb 100644
--- a/src/third_party/wiredtiger/src/utilities/util_load.c
+++ b/src/third_party/wiredtiger/src/utilities/util_load.c
@@ -341,7 +341,8 @@ config_reorder(WT_SESSION *session, char **list)
* information.
*/
if ((list[0] == NULL || list[1] == NULL || list[2] != NULL) ||
- (WT_PREFIX_MATCH(list[0], "file:") && WT_PREFIX_MATCH(list[0], "lsm:")))
+ (!WT_PREFIX_MATCH(list[0], "file:") && !WT_PREFIX_MATCH(list[0], "lsm:") &&
+ !WT_PREFIX_MATCH(list[0], "tiered:")))
return (format(session));
entry = list;
@@ -383,7 +384,7 @@ config_update(WT_SESSION *session, char **list)
for (listp = list; *listp != NULL; listp += 2)
if (WT_PREFIX_MATCH(*listp, "colgroup:") || WT_PREFIX_MATCH(*listp, "file:") ||
WT_PREFIX_MATCH(*listp, "index:") || WT_PREFIX_MATCH(*listp, "lsm:") ||
- WT_PREFIX_MATCH(*listp, "table:"))
+ WT_PREFIX_MATCH(*listp, "table:") || WT_PREFIX_MATCH(*listp, "tiered:"))
if (config_rename(session, listp, cmdname))
return (1);
diff --git a/src/third_party/wiredtiger/src/utilities/util_printlog.c b/src/third_party/wiredtiger/src/utilities/util_printlog.c
index 9d09470bbd9..615f11768ab 100644
--- a/src/third_party/wiredtiger/src/utilities/util_printlog.c
+++ b/src/third_party/wiredtiger/src/utilities/util_printlog.c
@@ -12,9 +12,15 @@ static int
usage(void)
{
static const char *options[] = {"-f", "output to the specified file", "-x",
- "display key and value items in hexadecimal format", NULL, NULL};
+ "display key and value items in hexadecimal format", "-l",
+ "the start LSN from which the log will be printed, optionally the end LSN can also be "
+ "specified",
+ NULL, NULL};
- util_usage("printlog [-x] [-f output-file]", "options:", options);
+ util_usage(
+ "printlog [-x] [-f output-file] [-l start-file,start-offset]|[-l "
+ "start-file,start-offset,end-file,end-offset]",
+ "options:", options);
return (1);
}
@@ -22,17 +28,37 @@ int
util_printlog(WT_SESSION *session, int argc, char *argv[])
{
WT_DECL_RET;
+ WT_LSN end_lsn, start_lsn;
+ uint32_t end_lsnfile, end_lsnoffset, start_lsnfile, start_lsnoffset;
uint32_t flags;
int ch;
- char *ofile;
+ int n_args;
+ char *ofile, *start_str;
+ bool end_set, start_set;
+ end_set = start_set = false;
flags = 0;
ofile = NULL;
- while ((ch = __wt_getopt(progname, argc, argv, "f:mx")) != EOF)
+
+ while ((ch = __wt_getopt(progname, argc, argv, "f:l:mx")) != EOF)
switch (ch) {
case 'f': /* output file */
ofile = __wt_optarg;
break;
+ case 'l':
+ start_str = __wt_optarg;
+ n_args = sscanf(start_str, "%" SCNu32 ",%" SCNu32 ",%" SCNu32 ",%" SCNu32,
+ &start_lsnfile, &start_lsnoffset, &end_lsnfile, &end_lsnoffset);
+ if (n_args == 2) {
+ WT_SET_LSN(&start_lsn, start_lsnfile, start_lsnoffset);
+ start_set = true;
+ } else if (n_args == 4) {
+ WT_SET_LSN(&start_lsn, start_lsnfile, start_lsnoffset);
+ WT_SET_LSN(&end_lsn, end_lsnfile, end_lsnoffset);
+ end_set = start_set = true;
+ } else
+ return (usage());
+ break;
case 'm': /* messages only */
LF_SET(WT_TXN_PRINTLOG_MSG);
break;
@@ -49,7 +75,8 @@ util_printlog(WT_SESSION *session, int argc, char *argv[])
if (argc != 0)
return (usage());
- if ((ret = __wt_txn_printlog(session, ofile, flags)) != 0)
+ if ((ret = __wt_txn_printlog(session, ofile, flags, start_set == true ? &start_lsn : NULL,
+ end_set == true ? &end_lsn : NULL)) != 0)
(void)util_err(session, ret, "printlog");
return (ret);