summaryrefslogtreecommitdiff
path: root/src/utilities
diff options
context:
space:
mode:
authorDon Anderson <dda@ddanderson.com>2015-12-04 10:06:13 -0500
committerDon Anderson <dda@ddanderson.com>2015-12-04 10:06:13 -0500
commitc19c1a7d5d52d35ab6c7959a6738630fe77a4fa5 (patch)
treecd45417124ba90bf8bab218150b134b9a819d713 /src/utilities
parente731ef8ab8b8f9d1c65380c83fc3e7b318f3fbe8 (diff)
downloadmongo-c19c1a7d5d52d35ab6c7959a6738630fe77a4fa5.tar.gz
WT-2235. Changes to wt printlog to add -x option and remove -p.
wt printlog -x produces extra "-hex" fields when appropriate. For example, when printing a "row_put" entry, in addition to "key" and "value" (printed as JSON strings with Unicode escapes), there will also be "key-hex" and "key-value" entries in the JSON dictionary, containing a hex dump for each of these fields. For consistency with existing WT outputs, all hex output is in lower case. One visible change is that our Unicode escapes in JSON, also used for 'wt dump -j', now produce hex characters in lower case ('a'-'f'). Before, 'wt dump -j' produced upper case hex (using 'A'-'F').
Diffstat (limited to 'src/utilities')
-rw-r--r--src/utilities/util_printlog.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/utilities/util_printlog.c b/src/utilities/util_printlog.c
index d202b09b228..3a665c1c657 100644
--- a/src/utilities/util_printlog.c
+++ b/src/utilities/util_printlog.c
@@ -15,10 +15,10 @@ util_printlog(WT_SESSION *session, int argc, char *argv[])
{
WT_DECL_RET;
int ch;
- bool printable;
+ uint32_t flags;
- printable = false;
- while ((ch = __wt_getopt(progname, argc, argv, "f:p")) != EOF)
+ flags = 0;
+ while ((ch = __wt_getopt(progname, argc, argv, "f:x")) != EOF)
switch (ch) {
case 'f': /* output file */
if (freopen(__wt_optarg, "w", stdout) == NULL) {
@@ -27,8 +27,8 @@ util_printlog(WT_SESSION *session, int argc, char *argv[])
return (1);
}
break;
- case 'p':
- printable = true;
+ case 'x': /* hex output */
+ LF_SET(WT_TXN_PRINTLOG_HEX);
break;
case '?':
default:
@@ -41,8 +41,7 @@ util_printlog(WT_SESSION *session, int argc, char *argv[])
if (argc != 0)
return (usage());
- WT_UNUSED(printable);
- ret = __wt_txn_printlog(session, stdout);
+ ret = __wt_txn_printlog(session, stdout, flags);
if (ret != 0) {
fprintf(stderr, "%s: printlog failed: %s\n",
@@ -61,7 +60,7 @@ usage(void)
{
(void)fprintf(stderr,
"usage: %s %s "
- "printlog [-p] [-f output-file]\n",
+ "printlog [-x] [-f output-file]\n",
progname, usage_prefix);
return (1);
}