From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 03/12] vinyl: rename dump/compact in/out to input/output Date: Tue, 15 Jan 2019 17:17:12 +0300 Message-Id: <8f7f7c0317cef74c3c56e4c814383b71485f84c8.1547558871.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org List-ID: 'in' is a reserved keyword in Lua, so using 'in' as a map key was a bad decision - one has to access it with [] rather than simply with dot. Let's rename 'in' to 'input' and 'out' to 'output' both in the output and in the code. --- src/box/vinyl.c | 32 ++++++++--------- src/box/vy_lsm.c | 24 ++++++------- src/box/vy_lsm.h | 8 ++--- src/box/vy_scheduler.c | 20 +++++------ src/box/vy_stat.h | 16 ++++----- test/vinyl/recovery_quota.result | 4 +-- test/vinyl/recovery_quota.test.lua | 4 +-- test/vinyl/stat.result | 68 ++++++++++++++++++------------------- test/vinyl/stat.test.lua | 8 ++--- test/vinyl/update_optimize.result | 4 +-- test/vinyl/update_optimize.test.lua | 4 +-- test/vinyl/write_iterator.result | 4 +-- test/vinyl/write_iterator.test.lua | 4 +-- 13 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index ca987134..f6139898 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -303,13 +303,13 @@ vy_info_append_disk(struct vy_env *env, struct info_handler *h) info_append_int(h, "index", stat->index); info_table_begin(h, "dump"); - info_append_int(h, "in", stat->dump.in); - info_append_int(h, "out", stat->dump.out); + info_append_int(h, "input", stat->dump.input); + info_append_int(h, "output", stat->dump.output); info_table_end(h); /* dump */ info_table_begin(h, "compact"); - info_append_int(h, "in", stat->compact.in); - info_append_int(h, "out", stat->compact.out); + info_append_int(h, "input", stat->compact.input); + info_append_int(h, "output", stat->compact.output); info_append_int(h, "queue", stat->compact.queue); info_table_end(h); /* compact */ @@ -414,13 +414,13 @@ vinyl_index_stat(struct index *index, struct info_handler *h) info_table_end(h); /* iterator */ 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); + vy_info_append_stmt_counter(h, "input", &stat->disk.dump.input); + vy_info_append_disk_stmt_counter(h, "output", &stat->disk.dump.output); 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); + vy_info_append_disk_stmt_counter(h, "input", &stat->disk.compact.input); + vy_info_append_disk_stmt_counter(h, "output", &stat->disk.compact.output); vy_info_append_disk_stmt_counter(h, "queue", &stat->disk.compact.queue); info_table_end(h); /* compact */ info_append_int(h, "index_size", lsm->page_index_size); @@ -476,13 +476,13 @@ vinyl_index_reset_stat(struct index *index) /* Dump */ stat->disk.dump.count = 0; - vy_stmt_counter_reset(&stat->disk.dump.in); - vy_disk_stmt_counter_reset(&stat->disk.dump.out); + vy_stmt_counter_reset(&stat->disk.dump.input); + vy_disk_stmt_counter_reset(&stat->disk.dump.output); /* Compaction */ stat->disk.compact.count = 0; - vy_disk_stmt_counter_reset(&stat->disk.compact.in); - vy_disk_stmt_counter_reset(&stat->disk.compact.out); + vy_disk_stmt_counter_reset(&stat->disk.compact.input); + vy_disk_stmt_counter_reset(&stat->disk.compact.output); /* Cache */ cache_stat->lookup = 0; @@ -515,10 +515,10 @@ vinyl_engine_reset_stat(struct engine *engine) memset(&xm->stat, 0, sizeof(xm->stat)); struct vy_disk_stat *disk_stat = &env->lsm_env.disk_stat; - disk_stat->dump.in = 0; - disk_stat->dump.out = 0; - disk_stat->compact.in = 0; - disk_stat->compact.out = 0; + disk_stat->dump.input = 0; + disk_stat->dump.output = 0; + disk_stat->compact.input = 0; + disk_stat->compact.output = 0; } /** }}} Introspection */ diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c index 681b165b..69319174 100644 --- a/src/box/vy_lsm.c +++ b/src/box/vy_lsm.c @@ -765,28 +765,28 @@ vy_lsm_unacct_range(struct vy_lsm *lsm, struct vy_range *range) void vy_lsm_acct_dump(struct vy_lsm *lsm, - const struct vy_stmt_counter *in, - const struct vy_disk_stmt_counter *out) + const struct vy_stmt_counter *input, + const struct vy_disk_stmt_counter *output) { lsm->stat.disk.dump.count++; - vy_stmt_counter_add(&lsm->stat.disk.dump.in, in); - vy_disk_stmt_counter_add(&lsm->stat.disk.dump.out, out); + vy_stmt_counter_add(&lsm->stat.disk.dump.input, input); + vy_disk_stmt_counter_add(&lsm->stat.disk.dump.output, output); - lsm->env->disk_stat.dump.in += in->bytes; - lsm->env->disk_stat.dump.out += out->bytes; + lsm->env->disk_stat.dump.input += input->bytes; + lsm->env->disk_stat.dump.output += output->bytes; } void vy_lsm_acct_compaction(struct vy_lsm *lsm, - const struct vy_disk_stmt_counter *in, - const struct vy_disk_stmt_counter *out) + const struct vy_disk_stmt_counter *input, + const struct vy_disk_stmt_counter *output) { lsm->stat.disk.compact.count++; - vy_disk_stmt_counter_add(&lsm->stat.disk.compact.in, in); - vy_disk_stmt_counter_add(&lsm->stat.disk.compact.out, out); + vy_disk_stmt_counter_add(&lsm->stat.disk.compact.input, input); + vy_disk_stmt_counter_add(&lsm->stat.disk.compact.output, output); - lsm->env->disk_stat.compact.in += in->bytes; - lsm->env->disk_stat.compact.out += out->bytes; + lsm->env->disk_stat.compact.input += input->bytes; + lsm->env->disk_stat.compact.output += output->bytes; } int diff --git a/src/box/vy_lsm.h b/src/box/vy_lsm.h index d8d9f9d0..07dc1b5c 100644 --- a/src/box/vy_lsm.h +++ b/src/box/vy_lsm.h @@ -455,16 +455,16 @@ vy_lsm_unacct_range(struct vy_lsm *lsm, struct vy_range *range); */ void vy_lsm_acct_dump(struct vy_lsm *lsm, - const struct vy_stmt_counter *in, - const struct vy_disk_stmt_counter *out); + const struct vy_stmt_counter *input, + const struct vy_disk_stmt_counter *output); /** * Account compaction in LSM tree statistics. */ void vy_lsm_acct_compaction(struct vy_lsm *lsm, - const struct vy_disk_stmt_counter *in, - const struct vy_disk_stmt_counter *out); + const struct vy_disk_stmt_counter *input, + const struct vy_disk_stmt_counter *output); /** * Allocate a new active in-memory index for an LSM tree while diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index 9221b973..72d2094e 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -1091,8 +1091,8 @@ vy_task_dump_complete(struct vy_task *task) struct vy_lsm *lsm = task->lsm; struct vy_run *new_run = task->new_run; int64_t dump_lsn = new_run->dump_lsn; - struct vy_disk_stmt_counter dump_out = new_run->count; - struct vy_stmt_counter dump_in; + struct vy_disk_stmt_counter dump_output = new_run->count; + struct vy_stmt_counter dump_input; struct tuple_format *key_format = lsm->env->key_format; struct vy_mem *mem, *next_mem; struct vy_slice **new_slices, *slice; @@ -1214,15 +1214,15 @@ delete_mems: * Delete dumped in-memory trees and account dump in * LSM tree statistics. */ - vy_stmt_counter_reset(&dump_in); + vy_stmt_counter_reset(&dump_input); rlist_foreach_entry_safe(mem, &lsm->sealed, in_sealed, next_mem) { if (mem->generation > scheduler->dump_generation) continue; - vy_stmt_counter_add(&dump_in, &mem->count); + vy_stmt_counter_add(&dump_input, &mem->count); vy_lsm_delete_mem(lsm, mem); } lsm->dump_lsn = MAX(lsm->dump_lsn, dump_lsn); - vy_lsm_acct_dump(lsm, &dump_in, &dump_out); + vy_lsm_acct_dump(lsm, &dump_input, &dump_output); /* The iterator has been cleaned up in a worker thread. */ task->wi->iface->close(task->wi); @@ -1444,8 +1444,8 @@ vy_task_compact_complete(struct vy_task *task) struct vy_lsm *lsm = task->lsm; struct vy_range *range = task->range; struct vy_run *new_run = task->new_run; - struct vy_disk_stmt_counter compact_out = new_run->count; - struct vy_disk_stmt_counter compact_in; + struct vy_disk_stmt_counter compact_output = new_run->count; + struct vy_disk_stmt_counter compact_input; struct vy_slice *first_slice = task->first_slice; struct vy_slice *last_slice = task->last_slice; struct vy_slice *slice, *next_slice, *new_slice = NULL; @@ -1547,12 +1547,12 @@ vy_task_compact_complete(struct vy_task *task) vy_lsm_unacct_range(lsm, range); if (new_slice != NULL) vy_range_add_slice_before(range, new_slice, first_slice); - vy_disk_stmt_counter_reset(&compact_in); + vy_disk_stmt_counter_reset(&compact_input); for (slice = first_slice; ; slice = next_slice) { next_slice = rlist_next_entry(slice, in_range); vy_range_remove_slice(range, slice); rlist_add_entry(&compacted_slices, slice, in_range); - vy_disk_stmt_counter_add(&compact_in, &slice->count); + vy_disk_stmt_counter_add(&compact_input, &slice->count); if (slice == last_slice) break; } @@ -1560,7 +1560,7 @@ vy_task_compact_complete(struct vy_task *task) range->version++; vy_range_update_compact_priority(range, &lsm->opts); vy_lsm_acct_range(lsm, range); - vy_lsm_acct_compaction(lsm, &compact_in, &compact_out); + vy_lsm_acct_compaction(lsm, &compact_input, &compact_output); /* * Unaccount unused runs and delete compacted slices. diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h index 9bb09174..ae032d1d 100644 --- a/src/box/vy_stat.h +++ b/src/box/vy_stat.h @@ -148,18 +148,18 @@ struct vy_lsm_stat { /* Number of completed tasks. */ int32_t count; /** Number of input statements. */ - struct vy_stmt_counter in; + struct vy_stmt_counter input; /** Number of output statements. */ - struct vy_disk_stmt_counter out; + struct vy_disk_stmt_counter output; } dump; /** Compaction statistics. */ struct { /* Number of completed tasks. */ int32_t count; /** Number of input statements. */ - struct vy_disk_stmt_counter in; + struct vy_disk_stmt_counter input; /** Number of output statements. */ - struct vy_disk_stmt_counter out; + struct vy_disk_stmt_counter output; /** Number of statements awaiting compaction. */ struct vy_disk_stmt_counter queue; } compact; @@ -215,12 +215,12 @@ struct vy_disk_stat { int64_t data; int64_t index; struct { - int64_t in; - int64_t out; + int64_t input; + int64_t output; } dump; struct { - int64_t in; - int64_t out; + int64_t input; + int64_t output; int64_t queue; } compact; }; diff --git a/test/vinyl/recovery_quota.result b/test/vinyl/recovery_quota.result index 151f280b..002aca94 100644 --- a/test/vinyl/recovery_quota.result +++ b/test/vinyl/recovery_quota.result @@ -52,7 +52,7 @@ stat = box.space.test.index.pk:stat() _ = var:insert{'put', stat.put.rows} --- ... -_ = var:insert{'dump', stat.disk.dump.out.rows} +_ = var:insert{'dump', stat.disk.dump.output.rows} --- ... test_run:cmd('restart server test with args="2097152"') @@ -74,7 +74,7 @@ var = box.space.var dump_before = var:get('dump')[2] --- ... -dump_after = stat.disk.dump.out.rows +dump_after = stat.disk.dump.output.rows --- ... put_before = var:get('put')[2] diff --git a/test/vinyl/recovery_quota.test.lua b/test/vinyl/recovery_quota.test.lua index 1e347667..b34e4d65 100644 --- a/test/vinyl/recovery_quota.test.lua +++ b/test/vinyl/recovery_quota.test.lua @@ -23,7 +23,7 @@ var = box.schema.space.create('var') _ = var:create_index('pk', {parts = {1, 'string'}}) stat = box.space.test.index.pk:stat() _ = var:insert{'put', stat.put.rows} -_ = var:insert{'dump', stat.disk.dump.out.rows} +_ = var:insert{'dump', stat.disk.dump.output.rows} test_run:cmd('restart server test with args="2097152"') -- Check that we do not exceed quota. stat = box.stat.vinyl() @@ -32,7 +32,7 @@ stat.memory.level0 <= box.cfg.vinyl_memory or {stat.memory.level0, box.cfg.vinyl stat = box.space.test.index.pk:stat() var = box.space.var dump_before = var:get('dump')[2] -dump_after = stat.disk.dump.out.rows +dump_after = stat.disk.dump.output.rows put_before = var:get('put')[2] put_after = stat.put.rows dump_after == 0 or dump_after diff --git a/test/vinyl/stat.result b/test/vinyl/stat.result index c4a0e632..315a5853 100644 --- a/test/vinyl/stat.result +++ b/test/vinyl/stat.result @@ -157,32 +157,32 @@ istat() upserts: 0 deletes: 0 dump: - in: + input: rows: 0 bytes: 0 count: 0 - out: + output: bytes_compressed: 0 pages: 0 rows: 0 bytes: 0 compact: - in: + input: bytes_compressed: 0 pages: 0 rows: 0 bytes: 0 count: 0 + output: + bytes_compressed: 0 + pages: 0 + rows: 0 + bytes: 0 queue: bytes_compressed: 0 pages: 0 rows: 0 bytes: 0 - out: - bytes_compressed: 0 - pages: 0 - rows: 0 - bytes: 0 iterator: read: bytes_compressed: 0 @@ -226,12 +226,12 @@ gstat() --- - disk: dump: - in: 0 - out: 0 + input: 0 + output: 0 compact: - in: 0 + input: 0 + output: 0 queue: 0 - out: 0 data: 0 index: 0 memory: @@ -280,11 +280,11 @@ stat_diff(istat(), st) run_count: 1 disk: dump: - in: + input: rows: 25 bytes: 26525 count: 1 - out: + output: bytes: 26049 pages: 7 bytes_compressed: @@ -320,11 +320,11 @@ stat_diff(istat(), st) --- - disk: dump: - in: + input: rows: 50 bytes: 53050 count: 1 - out: + output: bytes: 52091 pages: 13 bytes_compressed: @@ -337,13 +337,13 @@ stat_diff(istat(), st) statement: replaces: 25 compact: - in: + input: bytes: 78140 pages: 20 bytes_compressed: rows: 75 count: 1 - out: + output: bytes: 52091 pages: 13 bytes_compressed: @@ -701,19 +701,19 @@ box.rollback() -- Global statistics. -- -- dump and compaction totals -gstat().disk.dump['in'] == istat().disk.dump['in'].bytes +gstat().disk.dump.input == istat().disk.dump.input.bytes --- - true ... -gstat().disk.dump['out'] == istat().disk.dump['out'].bytes +gstat().disk.dump.output == istat().disk.dump.output.bytes --- - true ... -gstat().disk.compact['in'] == istat().disk.compact['in'].bytes +gstat().disk.compact.input == istat().disk.compact.input.bytes --- - true ... -gstat().disk.compact['out'] == istat().disk.compact['out'].bytes +gstat().disk.compact.output == istat().disk.compact.output.bytes --- - true ... @@ -1007,32 +1007,32 @@ istat() upserts: 0 deletes: 0 dump: - in: + input: rows: 0 bytes: 0 count: 0 - out: + output: bytes_compressed: pages: 0 rows: 0 bytes: 0 compact: - in: + input: bytes_compressed: pages: 0 rows: 0 bytes: 0 count: 0 + output: + bytes_compressed: + pages: 0 + rows: 0 + bytes: 0 queue: bytes_compressed: pages: 0 rows: 0 bytes: 0 - out: - bytes_compressed: - pages: 0 - rows: 0 - bytes: 0 iterator: read: bytes_compressed: @@ -1076,12 +1076,12 @@ gstat() --- - disk: dump: - in: 0 - out: 0 + input: 0 + output: 0 compact: - in: 0 + input: 0 + output: 0 queue: 0 - out: 0 data: 104300 index: 1190 memory: diff --git a/test/vinyl/stat.test.lua b/test/vinyl/stat.test.lua index 8b296b9e..56e544d1 100644 --- a/test/vinyl/stat.test.lua +++ b/test/vinyl/stat.test.lua @@ -205,10 +205,10 @@ box.rollback() -- -- dump and compaction totals -gstat().disk.dump['in'] == istat().disk.dump['in'].bytes -gstat().disk.dump['out'] == istat().disk.dump['out'].bytes -gstat().disk.compact['in'] == istat().disk.compact['in'].bytes -gstat().disk.compact['out'] == istat().disk.compact['out'].bytes +gstat().disk.dump.input == istat().disk.dump.input.bytes +gstat().disk.dump.output == istat().disk.dump.output.bytes +gstat().disk.compact.input == istat().disk.compact.input.bytes +gstat().disk.compact.output == istat().disk.compact.output.bytes -- use memory st = gstat() diff --git a/test/vinyl/update_optimize.result b/test/vinyl/update_optimize.result index bf9dff7e..d8ff9fc4 100644 --- a/test/vinyl/update_optimize.result +++ b/test/vinyl/update_optimize.result @@ -16,7 +16,7 @@ index = space:create_index('primary', { run_count_per_level = 20 }) index2 = space:create_index('secondary', { parts = {5, 'unsigned'}, run_count_per_level = 20 }) --- ... -function dumped_stmt_count() return index:stat().disk.dump.out.rows + index2:stat().disk.dump.out.rows end +function dumped_stmt_count() return index:stat().disk.dump.output.rows + index2:stat().disk.dump.output.rows end --- ... box.snapshot() @@ -217,7 +217,7 @@ index2 = space:create_index('secondary', { parts = {4, 'unsigned', 3, 'unsigned' index3 = space:create_index('third', { parts = {5, 'unsigned'}, run_count_per_level = 20 }) --- ... -function dumped_stmt_count() return index:stat().disk.dump.out.rows + index2:stat().disk.dump.out.rows + index3:stat().disk.dump.out.rows end +function dumped_stmt_count() return index:stat().disk.dump.output.rows + index2:stat().disk.dump.output.rows + index3:stat().disk.dump.output.rows end --- ... box.snapshot() diff --git a/test/vinyl/update_optimize.test.lua b/test/vinyl/update_optimize.test.lua index 67efba31..41ff964b 100644 --- a/test/vinyl/update_optimize.test.lua +++ b/test/vinyl/update_optimize.test.lua @@ -8,7 +8,7 @@ fiber = require('fiber') space = box.schema.space.create('test', { engine = 'vinyl' }) index = space:create_index('primary', { run_count_per_level = 20 }) index2 = space:create_index('secondary', { parts = {5, 'unsigned'}, run_count_per_level = 20 }) -function dumped_stmt_count() return index:stat().disk.dump.out.rows + index2:stat().disk.dump.out.rows end +function dumped_stmt_count() return index:stat().disk.dump.output.rows + index2:stat().disk.dump.output.rows end box.snapshot() test_run:cmd("setopt delimiter ';'") function wait_for_dump(index, old_count) @@ -76,7 +76,7 @@ space = box.schema.space.create('test', { engine = 'vinyl' }) index = space:create_index('primary', { parts = {2, 'unsigned'}, run_count_per_level = 20 } ) index2 = space:create_index('secondary', { parts = {4, 'unsigned', 3, 'unsigned'}, run_count_per_level = 20 }) index3 = space:create_index('third', { parts = {5, 'unsigned'}, run_count_per_level = 20 }) -function dumped_stmt_count() return index:stat().disk.dump.out.rows + index2:stat().disk.dump.out.rows + index3:stat().disk.dump.out.rows end +function dumped_stmt_count() return index:stat().disk.dump.output.rows + index2:stat().disk.dump.output.rows + index3:stat().disk.dump.output.rows end box.snapshot() index_run_count = index:stat().run_count index2_run_count = index2:stat().run_count diff --git a/test/vinyl/write_iterator.result b/test/vinyl/write_iterator.result index cf1e426c..e6bf1b01 100644 --- a/test/vinyl/write_iterator.result +++ b/test/vinyl/write_iterator.result @@ -854,11 +854,11 @@ sk:stat().disk.compact.count -- 1 ... -- All INSERT+DELETE pairs should have been annihilated, -- only padding is left. -pk:stat().disk.compact.out.rows - PAD2 -- 0 +pk:stat().disk.compact.output.rows - PAD2 -- 0 --- - 0 ... -sk:stat().disk.compact.out.rows - PAD2 -- 0 +sk:stat().disk.compact.output.rows - PAD2 -- 0 --- - 0 ... diff --git a/test/vinyl/write_iterator.test.lua b/test/vinyl/write_iterator.test.lua index a1de240f..a4ba42aa 100644 --- a/test/vinyl/write_iterator.test.lua +++ b/test/vinyl/write_iterator.test.lua @@ -361,8 +361,8 @@ pk:stat().disk.compact.count -- 1 sk:stat().disk.compact.count -- 1 -- All INSERT+DELETE pairs should have been annihilated, -- only padding is left. -pk:stat().disk.compact.out.rows - PAD2 -- 0 -sk:stat().disk.compact.out.rows - PAD2 -- 0 +pk:stat().disk.compact.output.rows - PAD2 -- 0 +sk:stat().disk.compact.output.rows - PAD2 -- 0 pk:select(1000, {iterator = 'LE'}) -- empty sk:select(1000, {iterator = 'LE'}) -- empty s:drop() -- 2.11.0