Skip to content
Snippets Groups Projects
Commit 21fc9a10 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

Tarantool client fixes.

* Make tarantool --play to understand user specified limits.
* Remove --catin, use -cat - instead.
parent 59880372
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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;
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment