diff --git a/client/tarantool/tc_opt.c b/client/tarantool/tc_opt.c index 5d771bdc0876dd1d19bc28abca1f2e139d17f8d1..c666b292110c7216f1539657afc8e71f9d8d10d0 100644 --- a/client/tarantool/tc_opt.c +++ b/client/tarantool/tc_opt.c @@ -49,8 +49,6 @@ static const void *tc_options_def = gopt_start( gopt_longs("admin-port"), " <port>", "server admin port"), gopt_option('C', GOPT_ARG, gopt_shorts('C'), gopt_longs("cat"), " <file>", "print xlog or snapshot file content"), - gopt_option('I', 0, gopt_shorts('C'), - gopt_longs("catin"), NULL, "print xlog content from stdin"), gopt_option('P', GOPT_ARG, gopt_shorts('P'), gopt_longs("play"), " <file>", "replay xlog file to the specified server"), gopt_option('S', GOPT_ARG, gopt_shorts('S'), @@ -160,13 +158,8 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv) /* wal-cat mode */ if (gopt_arg(tc_options, 'C', &opt->file)) { opt->mode = TC_OPT_WAL_CAT; - goto done; - } - - /* wal-cat mode from stdin */ - if (gopt(tc_options, 'I')) { - opt->mode = TC_OPT_WAL_CAT; - opt->file = NULL; + if (strcmp(opt->file, "-") == 0) + opt->file = NULL; goto done; } diff --git a/client/tarantool/tc_store.c b/client/tarantool/tc_store.c index dd5a40563f01bc35dc8488cf50c8c39bc1088097..c04d8c481b2fdd4c1149d51e65e486d3597bc8b4 100644 --- a/client/tarantool/tc_store.c +++ b/client/tarantool/tc_store.c @@ -98,25 +98,33 @@ static void tc_store_print(struct tnt_log_header_v11 *hdr, } } -static int tc_store_printer(struct tnt_iter *i) { - struct tnt_request *r = TNT_IREQUEST_PTR(i); +static int tc_store_check_skip(struct tnt_iter *i, struct tnt_request *r) { struct tnt_stream_xlog *s = TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i)); if (tc.opt.space_set) { if (r->h.type == TNT_OP_CALL) - return 0; + return 1; uint32_t ns = *(uint32_t*)&r->r; if (ns != tc.opt.space) - return 0; + return 1; } if (tc.opt.lsn_from_set) { if (s->log.current.hdr.lsn < tc.opt.lsn_from) - return 0; + return 1; } if (tc.opt.lsn_to_set) { if (s->log.current.hdr.lsn > tc.opt.lsn_to) - return 0; + return 1; } + return 0; +} + +static int tc_store_printer(struct tnt_iter *i) { + struct tnt_request *r = TNT_IREQUEST_PTR(i); + if (tc_store_check_skip(i, r)) + return 0; + struct tnt_stream_xlog *s = + TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i)); ((tc_printerf_t)tc.opt.printer)(&s->log.current.hdr, r); return 0; } @@ -214,6 +222,8 @@ int tc_store_cat(void) static int tc_store_resender(struct tnt_iter *i) { struct tnt_request *r = TNT_IREQUEST_PTR(i); + if (tc_store_check_skip(i, r)) + return 0; if (tc.net->write_request(tc.net, r) == -1) return tc_store_error("failed to write request"); char *e = NULL; diff --git a/doc/man/tarantool.pod b/doc/man/tarantool.pod index c666e9a4effc1f8d5dc608587f2e707ee858980e..e5b9832541f3c4e86f23275c21b21896fe38b8ca 100644 --- a/doc/man/tarantool.pod +++ b/doc/man/tarantool.pod @@ -24,11 +24,7 @@ Define server admin port. =item -C <file>, --cat <file> -Output xlog file or snapshot content. - -=item -I, --catin - -Output xlog file content from stdin. +Output xlog file or snapshot content. Filename '-' stands for stdin. =item -P <file>, --play <file>