From c6a675249e929f52bcba51ace5c833779adaf3db Mon Sep 17 00:00:00 2001
From: Dmitry Simonenko <pmwkaa@gmail.com>
Date: Fri, 16 Aug 2013 15:31:49 +0400
Subject: [PATCH] console client: add space filter for snapshot files

---
 client/tarantool/tc_opt.c   | 2 +-
 client/tarantool/tc_store.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/client/tarantool/tc_opt.c b/client/tarantool/tc_opt.c
index 331ad3e59a..93d0f4a008 100644
--- a/client/tarantool/tc_opt.c
+++ b/client/tarantool/tc_opt.c
@@ -53,7 +53,7 @@ static const void *tc_options_def = gopt_start(
 	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'),
-		    gopt_longs("space"), " <space>", "xlog file space number"),
+		    gopt_longs("space"), " <space>", "filter by space number"),
 	gopt_option('F', GOPT_ARG, gopt_shorts('F'),
 		    gopt_longs("from"), " <lsn>", "start xlog file from the specified lsn"),
 	gopt_option('T', GOPT_ARG, gopt_shorts('T'),
diff --git a/client/tarantool/tc_store.c b/client/tarantool/tc_store.c
index ec2bc020e7..17bb00650e 100644
--- a/client/tarantool/tc_store.c
+++ b/client/tarantool/tc_store.c
@@ -135,6 +135,10 @@ static int tc_snapshot_printer(struct tnt_iter *i) {
 	struct tnt_tuple *tu = TNT_ISTORAGE_TUPLE(i);
 	struct tnt_stream_snapshot *ss =
 		TNT_SSNAPSHOT_CAST(TNT_ISTORAGE_STREAM(i));
+	if (tc.opt.space_set) {
+		if (ss->log.current.row_snap.space != tc.opt.space)
+			return 0;
+	}
 	((tc_printerf_snap_t)tc.opt.snap_printer)(&ss->log.current.row_snap, tu);
 	return 0;
 }
-- 
GitLab