diff options
author | Keith Bostic <keith@wiredtiger.com> | 2012-06-18 19:39:49 +0000 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2012-06-18 19:39:49 +0000 |
commit | 1ec35d2bfa9c0ac21b01d1932c90c75600b5ea13 (patch) | |
tree | 1144f71d08e2cfc7b1b1c72ecde77e0a3ffb1e22 /src/utilities | |
parent | 13bd7f4b65b193ad92acf20eb18792704cb4fbcc (diff) | |
download | mongo-1ec35d2bfa9c0ac21b01d1932c90c75600b5ea13.tar.gz |
Get rid of "snapshot" at the API layer, drive the change down to the btree
handles; we'll get rid of "snapshot" in the rest of the system over time.
Diffstat (limited to 'src/utilities')
-rw-r--r-- | src/utilities/util_dump.c | 23 | ||||
-rw-r--r-- | src/utilities/util_list.c | 41 |
2 files changed, 33 insertions, 31 deletions
diff --git a/src/utilities/util_dump.c b/src/utilities/util_dump.c index 6f918b51774..9d06dd5ec4f 100644 --- a/src/utilities/util_dump.c +++ b/src/utilities/util_dump.c @@ -56,12 +56,15 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) WT_DECL_RET; size_t len; int ch, hex, reverse; - char *config, *name, *snapshot; + char *checkpoint, *config, *name; hex = reverse = 0; - config = name = snapshot = NULL; - while ((ch = util_getopt(argc, argv, "f:rs:x")) != EOF) + checkpoint = config = name = NULL; + while ((ch = util_getopt(argc, argv, "c:f:rx")) != EOF) switch (ch) { + case 'c': + checkpoint = util_optarg; + break; case 'f': /* output file */ if (freopen(util_optarg, "w", stdout) == NULL) return ( @@ -70,9 +73,6 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) case 'r': reverse = 1; break; - case 's': - snapshot = util_optarg; - break; case 'x': hex = 1; break; @@ -95,15 +95,16 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) dump_suffix() != 0) goto err; - len = snapshot == NULL ? 0 : strlen("snapshot=") + strlen(snapshot); + len = + checkpoint == NULL ? 0 : strlen("checkpoint=") + strlen(checkpoint); len += strlen(hex ? "dump=hex" : "dump=print"); if ((config = malloc(len + 10)) == NULL) goto err; - if (snapshot == NULL) + if (checkpoint == NULL) config[0] = '\0'; else { - (void)strcpy(config, "snapshot="); - (void)strcat(config, snapshot); + (void)strcpy(config, "checkpoint="); + (void)strcat(config, checkpoint); (void)strcat(config, ","); } (void)strcat(config, hex ? "dump=hex" : "dump=print"); @@ -376,7 +377,7 @@ usage(void) { (void)fprintf(stderr, "usage: %s %s " - "dump [-rx] [-f output-file] [-s snapshot] uri\n", + "dump [-rx] [-c checkpoint] [-f output-file] uri\n", progname, usage_prefix); return (1); } diff --git a/src/utilities/util_list.c b/src/utilities/util_list.c index 3cf3a988427..19db1677638 100644 --- a/src/utilities/util_list.c +++ b/src/utilities/util_list.c @@ -8,22 +8,22 @@ #include "util.h" static int list_print(WT_SESSION *, const char *, int, int); -static int list_print_snapshot(WT_SESSION *, const char *); +static int list_print_checkpoint(WT_SESSION *, const char *); static int usage(void); int util_list(WT_SESSION *session, int argc, char *argv[]) { WT_DECL_RET; - int ch, sflag, vflag; + int cflag, ch, vflag; char *name; - sflag = vflag = 0; + cflag = vflag = 0; name = NULL; - while ((ch = util_getopt(argc, argv, "sv")) != EOF) + while ((ch = util_getopt(argc, argv, "cv")) != EOF) switch (ch) { - case 's': - sflag = 1; + case 'c': + cflag = 1; break; case 'v': vflag = 1; @@ -47,7 +47,7 @@ util_list(WT_SESSION *session, int argc, char *argv[]) return (usage()); } - ret = list_print(session, name, sflag, vflag); + ret = list_print(session, name, cflag, vflag); if (name != NULL) free(name); @@ -60,7 +60,7 @@ util_list(WT_SESSION *session, int argc, char *argv[]) * List the high-level objects in the database. */ static int -list_print(WT_SESSION *session, const char *name, int sflag, int vflag) +list_print(WT_SESSION *session, const char *name, int cflag, int vflag) { WT_CURSOR *cursor; WT_DECL_RET; @@ -71,12 +71,12 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) * XXX * Normally, we don't say anything about the WiredTiger metadata file, * it's not an "object" in the database. I'm making an exception for - * -s and -v, the snapshot and verbose options. + * -c and -v, the checkpoint and verbose options. */ - if (sflag || vflag) { + if (cflag || vflag) { uri = WT_METADATA_URI; printf("%s\n", uri); - if (sflag && (ret = list_print_snapshot(session, uri)) != 0) + if (cflag && (ret = list_print_checkpoint(session, uri)) != 0) return (ret); if (vflag) { if ((ret = @@ -124,10 +124,10 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) found = 1; } printf("%s\n", key); - if (!sflag && !vflag) + if (!cflag && !vflag) continue; - if (sflag && (ret = list_print_snapshot(session, key)) != 0) + if (cflag && (ret = list_print_checkpoint(session, key)) != 0) return (ret); if (vflag) { if ((ret = cursor->get_value(cursor, &value)) != 0) @@ -147,11 +147,11 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) } /* - * list_print_snapshot -- - * List the snapshot information. + * list_print_checkpoint -- + * List the checkpoint information. */ static int -list_print_snapshot(WT_SESSION *session, const char *key) +list_print_checkpoint(WT_SESSION *session, const char *key) { WT_DECL_RET; WT_SNAPSHOT *snap, *snapbase; @@ -161,9 +161,10 @@ list_print_snapshot(WT_SESSION *session, const char *key) char buf[256]; /* - * We may not find any snapshots for this file, in which case we don't - * report an error, and continue our caller's loop. Otherwise, report - * each snapshot's name and time. + * We may not find any checkpoints for this file, in which case we don't + * report an error, and continue our caller's loop. Otherwise, read the + * list of snapshots (which is the same as the list of checkpoints), and + * print each snapshot's name and time. */ if ((ret = __wt_metadata_get_snaplist(session, key, &snapbase)) != 0) return (ret == WT_NOTFOUND ? 0 : ret); @@ -203,7 +204,7 @@ usage(void) { (void)fprintf(stderr, "usage: %s %s " - "list [-sv] [uri]\n", + "list [-cv] [uri]\n", progname, usage_prefix); return (1); } |