[PATCH 09/12] vinyl: don't account secondary indexes to scheduler.dump_input

Vladimir Davydov vdavydov.dev at gmail.com
Tue Jan 15 17:17:18 MSK 2019


Indexes of the same space share a memory level so we should account them
to box.stat.vinyl().scheduler.dump_input once per space dump, not each
time an index is dumped.
---
 src/box/vy_scheduler.c | 7 ++++++-
 test/vinyl/stat.result | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c
index d06da484..e49cd211 100644
--- a/src/box/vy_scheduler.c
+++ b/src/box/vy_scheduler.c
@@ -1269,7 +1269,12 @@ delete_mems:
 	}
 	lsm->dump_lsn = MAX(lsm->dump_lsn, dump_lsn);
 	vy_lsm_acct_dump(lsm, &dump_input, &dump_output);
-	scheduler->stat.dump_input += dump_input.bytes;
+	/*
+	 * Indexes of the same space share a memory level so we
+	 * account dump input only when the primary index is dumped.
+	 */
+	if (lsm->index_id == 0)
+		scheduler->stat.dump_input += dump_input.bytes;
 	scheduler->stat.dump_output += dump_output.bytes;
 
 	/* The iterator has been cleaned up in a worker thread. */
diff --git a/test/vinyl/stat.result b/test/vinyl/stat.result
index e8780e5b..3050e43d 100644
--- a/test/vinyl/stat.result
+++ b/test/vinyl/stat.result
@@ -1125,7 +1125,7 @@ box.snapshot()
 stat_diff(gstat(), st, 'scheduler')
 ---
 - dump_count: 1
-  dump_input: 208400
+  dump_input: 104200
   dump_output: 103592
 ...
 for i = 1, 100, 10 do s:replace{i, i, string.rep('y', 1000)} end
@@ -1141,7 +1141,7 @@ box.snapshot()
 stat_diff(gstat(), st, 'scheduler')
 ---
 - dump_count: 1
-  dump_input: 21230
+  dump_input: 10420
   dump_output: 10371
 ...
 st = gstat()
-- 
2.11.0




More information about the Tarantool-patches mailing list