[PATCH v2 4/8] vinyl: report pages and bytes_compressed in dump/compact in/out stats

Vladimir Davydov vdavydov.dev at gmail.com
Sun Sep 16 20:06:47 MSK 2018


There's no reason not to report pages and bytes_compressed under
disk.stat.dump.out and disk.stat.compact.{in,out} apart from using
the same struct for dump and compaction statistics (vy_compact_stat).
The statistics are going to differ anyway once compaction queue size
is added to disk.stat.compact so let's zap struct vy_compact_stat
and report as much info as we can.
---
 src/box/vinyl.c        | 23 ++++++++++-------------
 src/box/vy_scheduler.c |  6 +++---
 src/box/vy_stat.h      | 27 ++++++++++++++++-----------
 test/vinyl/info.result | 28 ++++++++++++++++++++++++----
 4 files changed, 53 insertions(+), 31 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index ce58247a..197f16d6 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -337,17 +337,6 @@ vy_info_append_disk_stmt_counter(struct info_handler *h, const char *name,
 }
 
 static void
-vy_info_append_compact_stat(struct info_handler *h, const char *name,
-			    const struct vy_compact_stat *stat)
-{
-	info_table_begin(h, name);
-	info_append_int(h, "count", stat->count);
-	vy_info_append_stmt_counter(h, "in", &stat->in);
-	vy_info_append_stmt_counter(h, "out", &stat->out);
-	info_table_end(h);
-}
-
-static void
 vinyl_index_stat(struct index *index, struct info_handler *h)
 {
 	char buf[1024];
@@ -398,8 +387,16 @@ vinyl_index_stat(struct index *index, struct info_handler *h)
 	info_append_int(h, "miss", stat->disk.iterator.bloom_miss);
 	info_table_end(h); /* bloom */
 	info_table_end(h); /* iterator */
-	vy_info_append_compact_stat(h, "dump", &stat->disk.dump);
-	vy_info_append_compact_stat(h, "compact", &stat->disk.compact);
+	info_table_begin(h, "dump");
+	info_append_int(h, "count", stat->disk.dump.count);
+	vy_info_append_stmt_counter(h, "in", &stat->disk.dump.in);
+	vy_info_append_disk_stmt_counter(h, "out", &stat->disk.dump.out);
+	info_table_end(h); /* dump */
+	info_table_begin(h, "compact");
+	info_append_int(h, "count", stat->disk.compact.count);
+	vy_info_append_disk_stmt_counter(h, "in", &stat->disk.compact.in);
+	vy_info_append_disk_stmt_counter(h, "out", &stat->disk.compact.out);
+	info_table_end(h); /* compact */
 	info_append_int(h, "index_size", lsm->page_index_size);
 	info_append_int(h, "bloom_size", lsm->bloom_size);
 	info_table_end(h); /* disk */
diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c
index 08de214a..dd1e88d2 100644
--- a/src/box/vy_scheduler.c
+++ b/src/box/vy_scheduler.c
@@ -1182,7 +1182,7 @@ vy_task_dump_complete(struct vy_task *task)
 	 * Account the new run.
 	 */
 	vy_lsm_add_run(lsm, new_run);
-	vy_stmt_counter_add_disk(&lsm->stat.disk.dump.out, &new_run->count);
+	vy_disk_stmt_counter_add(&lsm->stat.disk.dump.out, &new_run->count);
 
 	/* Drop the reference held by the task. */
 	vy_run_unref(new_run);
@@ -1521,7 +1521,7 @@ vy_task_compact_complete(struct vy_task *task)
 	 */
 	if (new_slice != NULL) {
 		vy_lsm_add_run(lsm, new_run);
-		vy_stmt_counter_add_disk(&lsm->stat.disk.compact.out,
+		vy_disk_stmt_counter_add(&lsm->stat.disk.compact.out,
 					 &new_run->count);
 		/* Drop the reference held by the task. */
 		vy_run_unref(new_run);
@@ -1544,7 +1544,7 @@ vy_task_compact_complete(struct vy_task *task)
 		next_slice = rlist_next_entry(slice, in_range);
 		vy_range_remove_slice(range, slice);
 		rlist_add_entry(&compacted_slices, slice, in_range);
-		vy_stmt_counter_add_disk(&lsm->stat.disk.compact.in,
+		vy_disk_stmt_counter_add(&lsm->stat.disk.compact.in,
 					 &slice->count);
 		if (slice == last_slice)
 			break;
diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h
index ca52c4d3..6d37e79f 100644
--- a/src/box/vy_stat.h
+++ b/src/box/vy_stat.h
@@ -101,15 +101,6 @@ struct vy_txw_iterator_stat {
 	struct vy_stmt_counter get;
 };
 
-/** Dump/compaction statistics. */
-struct vy_compact_stat {
-	int32_t count;
-	/** Number of input statements. */
-	struct vy_stmt_counter in;
-	/** Number of output statements. */
-	struct vy_stmt_counter out;
-};
-
 /** LSM tree statistics. */
 struct vy_lsm_stat {
 	/** Number of lookups in the LSM tree. */
@@ -141,9 +132,23 @@ struct vy_lsm_stat {
 		/** Run iterator statistics. */
 		struct vy_run_iterator_stat iterator;
 		/** Dump statistics. */
-		struct vy_compact_stat dump;
+		struct {
+			/* Number of completed tasks. */
+			int32_t count;
+			/** Number of input statements. */
+			struct vy_stmt_counter in;
+			/** Number of output statements. */
+			struct vy_disk_stmt_counter out;
+		} dump;
 		/** Compaction statistics. */
-		struct vy_compact_stat compact;
+		struct {
+			/* Number of completed tasks. */
+			int32_t count;
+			/** Number of input statements. */
+			struct vy_disk_stmt_counter in;
+			/** Number of output statements. */
+			struct vy_disk_stmt_counter out;
+		} compact;
 	} disk;
 	/** TX write set statistics. */
 	struct {
diff --git a/test/vinyl/info.result b/test/vinyl/info.result
index a53ee3ae..3d7108cc 100644
--- a/test/vinyl/info.result
+++ b/test/vinyl/info.result
@@ -160,14 +160,20 @@ istat()
         bytes: 0
       count: 0
       out:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
     compact:
       in:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
       count: 0
       out:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
     iterator:
@@ -264,8 +270,10 @@ stat_diff(istat(), st)
         bytes: 26525
       count: 1
       out:
-        rows: 25
         bytes: 26049
+        pages: 7
+        bytes_compressed: <bytes_compressed>
+        rows: 25
     index_size: 294
     rows: 25
     bloom_size: 70
@@ -300,8 +308,10 @@ stat_diff(istat(), st)
         bytes: 53050
       count: 1
       out:
-        rows: 50
         bytes: 52091
+        pages: 13
+        bytes_compressed: <bytes_compressed>
+        rows: 50
     index_size: 252
     rows: 25
     bytes_compressed: <bytes_compressed>
@@ -309,12 +319,16 @@ stat_diff(istat(), st)
     bytes: 26042
     compact:
       in:
-        rows: 75
         bytes: 78140
+        pages: 20
+        bytes_compressed: <bytes_compressed>
+        rows: 75
       count: 1
       out:
-        rows: 50
         bytes: 52091
+        pages: 13
+        bytes_compressed: <bytes_compressed>
+        rows: 50
   put:
     rows: 50
     bytes: 53050
@@ -958,14 +972,20 @@ istat()
         bytes: 0
       count: 0
       out:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
     compact:
       in:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
       count: 0
       out:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
     iterator:
-- 
2.11.0




More information about the Tarantool-patches mailing list