Skip to content
Snippets Groups Projects
Commit c89f42ba authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'stable'

parents 555fe6d3 b559ecbe
No related branches found
No related tags found
No related merge requests found
......@@ -322,6 +322,10 @@ xlog_process(struct ts_spaces *s, char *wal_dir, uint64_t file_lsn,
*last = xs->log.current.hdr.lsn;
if (xs->log.current.hdr.lsn <= start)
continue;
if (tss.opts.to_lsn_set && xs->log.current.hdr.lsn > tss.opts.to_lsn) {
rc = 1;
goto done;
}
rc = xlog_process_row(s, fileid, xs->log.current_offset, r);
if (rc == -1)
goto done;
......@@ -352,8 +356,8 @@ waldir_processof(struct ts_spaces *s, struct tnt_dir *wal_dir, int i)
if (i < wal_dir->count) {
rc = xlog_process(s, wal_dir->path, wal_dir->files[i].lsn,
tss.last_snap_lsn, &tss.last_xlog_lsn);
if (rc == -1)
return -1;
if (rc == -1 || rc == -1)
return rc;
}
for (i++; i < wal_dir->count; i++) {
rc = xlog_process(s, wal_dir->path, wal_dir->files[i].lsn,
......@@ -361,7 +365,7 @@ waldir_processof(struct ts_spaces *s, struct tnt_dir *wal_dir, int i)
if (rc == -1)
return -1;
}
return 0;
return rc;
}
static int
......
......@@ -44,6 +44,8 @@
static const void *opts_def = gopt_start(
gopt_option('c', 0, gopt_shorts('c'),
gopt_longs("create"), NULL, "create snapshot file"),
gopt_option('l', GOPT_ARG, gopt_shorts('l'),
gopt_longs("lsn"), " <u64>", "snapshot lsn (latest by default)"),
gopt_option('?', 0, gopt_shorts(0), gopt_longs("help"),
NULL, "display this help and exit"),
gopt_option('v', 0, gopt_shorts('v'), gopt_longs("version"),
......@@ -81,6 +83,13 @@ ts_options_process(struct ts_options *opts, int argc, char **argv)
opts->mode = TS_MODE_VERSION;
goto done;
}
/* lsn */
const char *arg = NULL;
if (gopt_arg(opt, 'l', &arg)) {
opts->to_lsn = atoll(arg);
opts->to_lsn_set = 1;
}
/* generate or verify */
if (gopt(opt, 'c')) {
opts->mode = TS_MODE_CREATE;
......
......@@ -9,6 +9,8 @@ enum ts_options_mode {
struct ts_options {
enum ts_options_mode mode;
int to_lsn_set;
uint64_t to_lsn;
const char *file_config;
struct tarantool_cfg cfg;
};
......
......@@ -7,7 +7,8 @@ struct ts {
struct ts_reftable rt;
uint64_t last_snap_lsn;
uint64_t last_xlog_lsn;
int to_lsn_set;
uint64_t to_lsn;
struct slab_cache sc;
struct region ra;
};
......
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