diff --git a/src/box/vinyl.c b/src/box/vinyl.c index a134657e6e19fec0abeff968666035101f351955..b473eec346266d631d84a9f5ff12bbc66c4a5aa2 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -153,21 +153,6 @@ static void vy_gc(struct vy_env *env, struct vy_recovery *recovery, unsigned int gc_mask, int64_t gc_lsn); -struct vy_latency { - uint64_t count; - double total; - double max; -}; - -static void -vy_latency_update(struct vy_latency *lat, double v) -{ - lat->count++; - lat->total += v; - if (v > lat->max) - lat->max = v; -} - static int path_exists(const char *path) { @@ -197,20 +182,8 @@ static const char *vy_stat_strings[] = { struct vy_stat { struct rmean *rmean; - uint64_t write_count; - /** - * The total count of dumped statemnts. - * Doesn't count compactions and splits. - * Used to test optimization of UPDATE and UPSERT - * optimization. - * @sa vy_can_skip_update(). - */ - uint64_t dumped_statements; uint64_t tx_rlb; uint64_t tx_conflict; - struct vy_latency get_latency; - struct vy_latency tx_latency; - struct vy_latency cursor_latency; /** * Dump bandwidth is needed for calculating the quota watermark. * The higher the bandwidth, the later we can start dumping w/o @@ -223,7 +196,6 @@ struct vy_stat { * best result among 10% worst measurements. */ struct histogram *dump_bw; - int64_t dump_total; }; static struct vy_stat * @@ -278,43 +250,6 @@ vy_stat_delete(struct vy_stat *s) free(s); } -static void -vy_stat_get(struct vy_stat *s, ev_tstamp start) -{ - ev_tstamp diff = ev_now(loop()) - start; - rmean_collect(s->rmean, VY_STAT_GET, 1); - vy_latency_update(&s->get_latency, diff); -} - -static void -vy_stat_tx(struct vy_stat *s, ev_tstamp start, - int ops, int write_count, size_t write_size) -{ - ev_tstamp diff = ev_now(loop()) - start; - rmean_collect(s->rmean, VY_STAT_TX, 1); - rmean_collect(s->rmean, VY_STAT_TX_OPS, ops); - rmean_collect(s->rmean, VY_STAT_TX_WRITE, write_size); - s->write_count += write_count; - vy_latency_update(&s->tx_latency, diff); -} - -static void -vy_stat_cursor(struct vy_stat *s, ev_tstamp start, int ops) -{ - ev_tstamp diff = ev_now(loop()) - start; - rmean_collect(s->rmean, VY_STAT_CURSOR, 1); - rmean_collect(s->rmean, VY_STAT_CURSOR_OPS, ops); - vy_latency_update(&s->cursor_latency, diff); -} - -static void -vy_stat_dump(struct vy_stat *s, size_t written, - uint64_t dumped_statements) -{ - s->dump_total += written; - s->dumped_statements += dumped_statements; -} - static int64_t vy_stat_dump_bandwidth(struct vy_stat *s) { @@ -700,8 +635,6 @@ struct vy_tx { * the write set. */ size_t write_size; - /** Transaction start time saved in vy_begin() */ - ev_tstamp start; /** Current state of the transaction.*/ enum tx_state state; /** @@ -2910,10 +2843,6 @@ struct vy_task { struct diag diag; /** Index this task is for. */ struct vy_index *index; - /** Number of bytes written to disk by this task. */ - size_t dump_size; - /** Number of statements dumped to the disk. */ - uint64_t dumped_statements; /** Range to compact. */ struct vy_range *range; /** Run written by this task. */ @@ -2995,8 +2924,7 @@ vy_task_dump_execute(struct vy_task *task) index->space_id, index->id, task->wi, task->page_size, index->key_def, index->user_key_def, task->max_output_count, - task->bloom_fpr, &task->dump_size, - &task->dumped_statements); + task->bloom_fpr); } static int @@ -3341,8 +3269,7 @@ vy_task_compact_execute(struct vy_task *task) index->space_id, index->id, task->wi, task->page_size, index->key_def, index->user_key_def, task->max_output_count, - task->bloom_fpr, &task->dump_size, - &task->dumped_statements); + task->bloom_fpr); } static int @@ -3945,9 +3872,6 @@ vy_scheduler_f(va_list va) tasks_failed++; else tasks_done++; - if (task->dump_size > 0) - vy_stat_dump(env->stat, task->dump_size, - task->dumped_statements); vy_task_delete(&scheduler->task_pool, task); scheduler->workers_available++; assert(scheduler->workers_available <= @@ -4422,17 +4346,6 @@ vy_info_append_stat_rmean(const char *name, int rps, int64_t total, void *ctx) return 0; } -static void -vy_info_append_stat_latency(struct info_handler *h, - const char *name, struct vy_latency *lat) -{ - info_table_begin(h, name); - info_append_int(h, "max", lat->max * 1000000000); - info_append_int(h, "avg", lat->count == 0 ? 0 : - lat->total / lat->count * 1000000000); - info_table_end(h); -} - static void vy_info_append_performance(struct vy_env *env, struct info_handler *h) { @@ -4442,12 +4355,6 @@ vy_info_append_performance(struct vy_env *env, struct info_handler *h) rmean_foreach(stat->rmean, vy_info_append_stat_rmean, h); - info_append_int(h, "write_count", stat->write_count); - - vy_info_append_stat_latency(h, "tx_latency", &stat->tx_latency); - vy_info_append_stat_latency(h, "get_latency", &stat->get_latency); - vy_info_append_stat_latency(h, "cursor_latency", &stat->cursor_latency); - info_append_int(h, "tx_rollback", stat->tx_rlb); info_append_int(h, "tx_conflict", stat->tx_conflict); info_append_int(h, "tx_active", env->xm->tx_count); @@ -4461,8 +4368,6 @@ vy_info_append_performance(struct vy_env *env, struct info_handler *h) info_append_int(h, "read_view", mstats.objcount); info_append_int(h, "dump_bandwidth", vy_stat_dump_bandwidth(stat)); - info_append_int(h, "dump_total", stat->dump_total); - info_append_int(h, "dumped_statements", stat->dumped_statements); struct vy_cache_env *ce = &env->cache_env; info_table_begin(h, "cache"); @@ -5384,7 +5289,6 @@ vy_index_get(struct vy_tx *tx, struct vy_index *index, const char *key, vykey = vy_stmt_new_select(e->key_format, key, part_count); if (vykey == NULL) return -1; - ev_tstamp start = ev_now(loop()); const struct vy_read_view **p_read_view; if (tx != NULL) { p_read_view = (const struct vy_read_view **) &tx->read_view; @@ -5404,7 +5308,7 @@ vy_index_get(struct vy_tx *tx, struct vy_index *index, const char *key, if (*result != NULL) tuple_ref(*result); vy_read_iterator_close(&itr); - vy_stat_get(e->stat, start); + rmean_collect(e->stat->rmean, VY_STAT_GET, 1); return 0; error: tuple_unref(vykey); @@ -6288,7 +6192,6 @@ vy_tx_create(struct tx_manager *xm, struct vy_tx *tx) write_set_new(&tx->write_set); tx->write_set_version = 0; tx->write_size = 0; - tx->start = ev_now(loop()); tx->xm = xm; tx->state = VINYL_TX_READY; tx->read_view = (struct vy_read_view *) xm->p_global_read_view; @@ -6484,7 +6387,7 @@ vy_tx_prepare(struct vy_tx *tx) * Sic: the loop below must not yield after recovery. */ size_t mem_used_before = lsregion_used(&env->allocator); - int count = 0, write_count = 0; + int write_count = 0; /* repsert - REPLACE/UPSERT */ const struct tuple *delete = NULL, *repsert = NULL; MAYBE_UNUSED uint32_t current_space_id = 0; @@ -6540,7 +6443,9 @@ vy_tx_prepare(struct vy_tx *tx) vy_quota_release(&env->quota, tx->write_size - write_size); if (rc != 0) return -1; - vy_stat_tx(env->stat, tx->start, count, write_count, write_size); + rmean_collect(env->stat->rmean, VY_STAT_TX, 1); + rmean_collect(env->stat->rmean, VY_STAT_TX_OPS, write_count); + rmean_collect(env->stat->rmean, VY_STAT_TX_WRITE, write_size); xm->last_prepared_tx = tx; return 0; } @@ -8880,7 +8785,6 @@ vy_cursor_new(struct vy_tx *tx, struct vy_index *index, const char *key, rlist_add(&tx->cursors, &c->next_in_tx); } c->tx = tx; - c->start = tx->start; c->need_check_eq = false; enum iterator_type iterator_type; switch (type) { @@ -8978,7 +8882,8 @@ vy_cursor_delete(struct vy_cursor *c) } if (c->key) tuple_unref(c->key); - vy_stat_cursor(e->stat, c->start, c->n_reads); + rmean_collect(e->stat->rmean, VY_STAT_CURSOR, 1); + rmean_collect(e->stat->rmean, VY_STAT_CURSOR_OPS, c->n_reads); TRASH(c); mempool_free(&e->cursor_pool, c); } diff --git a/src/box/vy_run.c b/src/box/vy_run.c index 0293f186b300587b6fd355017d872fa2a4ea2085..821c630671943932b3f4c65885916765aa9ac089 100644 --- a/src/box/vy_run.c +++ b/src/box/vy_run.c @@ -2494,8 +2494,7 @@ vy_run_write(struct vy_run *run, const char *dirpath, struct vy_stmt_stream *wi, uint64_t page_size, const struct key_def *key_def, const struct key_def *user_key_def, - size_t max_output_count, double bloom_fpr, - size_t *written, uint64_t *dumped_statements) + size_t max_output_count, double bloom_fpr) { ERROR_INJECT(ERRINJ_VY_RUN_WRITE, {diag_set(ClientError, ER_INJECTION, @@ -2516,8 +2515,6 @@ vy_run_write(struct vy_run *run, const char *dirpath, if (vy_run_write_index(run, dirpath, space_id, iid) != 0) return -1; - *written += run->count.bytes_compressed; - *dumped_statements += run->count.rows; return 0; } diff --git a/src/box/vy_run.h b/src/box/vy_run.h index 9a79bf41b11c3b3231c232e9091100c8cdf7402e..92556e77d78f6175d7f281e95bc24560277d8518 100644 --- a/src/box/vy_run.h +++ b/src/box/vy_run.h @@ -370,8 +370,7 @@ vy_run_write(struct vy_run *run, const char *dirpath, struct vy_stmt_stream *wi, uint64_t page_size, const struct key_def *key_def, const struct key_def *user_key_def, - size_t max_output_count, double bloom_fpr, - size_t *written, uint64_t *dumped_statements); + size_t max_output_count, double bloom_fpr); /** * Allocate a new run slice. diff --git a/test/vinyl/recovery_quota.result b/test/vinyl/recovery_quota.result index c70bfc4439fd441f71e3201aa8c194d5c4c82fb8..eadb156d78b37f70c3f43c79101735d05015b1fe 100644 --- a/test/vinyl/recovery_quota.result +++ b/test/vinyl/recovery_quota.result @@ -38,13 +38,13 @@ var = box.schema.space.create('var') _ = var:create_index('pk', {parts = {1, 'string'}}) --- ... -stat = box.info.vinyl() +stat = box.space.test.index.pk:info() --- ... -_ = var:insert{'committed', stat.performance.write_count} +_ = var:insert{'put', stat.put.rows} --- ... -_ = var:insert{'dumped', stat.performance.dumped_statements} +_ = var:insert{'dump', stat.disk.dump.out.rows} --- ... test_run:cmd('switch default') @@ -59,35 +59,38 @@ test_run:cmd('switch test') --- - true ... +-- Check that we do not exceed quota. stat = box.info.vinyl() --- ... --- Check that we do not exceed quota. stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} --- - true ... -- Check that we did not replay statements dumped before restart. +stat = box.space.test.index.pk:info() +--- +... var = box.space.var --- ... -dumped_before = var:get('dumped')[2] +dump_before = var:get('dump')[2] --- ... -dumped_after = stat.performance.dumped_statements +dump_after = stat.disk.dump.out.rows --- ... -committed_before = var:get('committed')[2] +put_before = var:get('put')[2] --- ... -committed_after = stat.performance.write_count +put_after = stat.put.rows --- ... -dumped_after == 0 or dumped_after +dump_after == 0 or dump_after --- - true ... -committed_before - dumped_before == committed_after or {dumped_before, dumped_after, committed_before, committed_after} +put_before - dump_before == put_after or {dump_before, dump_after, put_before, put_after} --- - true ... diff --git a/test/vinyl/recovery_quota.test.lua b/test/vinyl/recovery_quota.test.lua index 251ff856b0b4c82842be944900c9585b9a7ef8ba..cf0c1eac022cf8032bc5dc51b69b0fc97667e06c 100644 --- a/test/vinyl/recovery_quota.test.lua +++ b/test/vinyl/recovery_quota.test.lua @@ -18,25 +18,26 @@ for i = 1, 2000 do s:insert{i, pad} end -- Save the total number of committed and dumped statements. var = box.schema.space.create('var') _ = var:create_index('pk', {parts = {1, 'string'}}) -stat = box.info.vinyl() -_ = var:insert{'committed', stat.performance.write_count} -_ = var:insert{'dumped', stat.performance.dumped_statements} +stat = box.space.test.index.pk:info() +_ = var:insert{'put', stat.put.rows} +_ = var:insert{'dump', stat.disk.dump.out.rows} test_run:cmd('switch default') test_run:cmd('restart server test') test_run:cmd('switch test') -stat = box.info.vinyl() -- Check that we do not exceed quota. +stat = box.info.vinyl() stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} -- Check that we did not replay statements dumped before restart. +stat = box.space.test.index.pk:info() var = box.space.var -dumped_before = var:get('dumped')[2] -dumped_after = stat.performance.dumped_statements -committed_before = var:get('committed')[2] -committed_after = stat.performance.write_count -dumped_after == 0 or dumped_after -committed_before - dumped_before == committed_after or {dumped_before, dumped_after, committed_before, committed_after} +dump_before = var:get('dump')[2] +dump_after = stat.disk.dump.out.rows +put_before = var:get('put')[2] +put_after = stat.put.rows +dump_after == 0 or dump_after +put_before - dump_before == put_after or {dump_before, dump_after, put_before, put_after} test_run:cmd('switch default') test_run:cmd('stop server test') diff --git a/test/vinyl/update_optimize.result b/test/vinyl/update_optimize.result index 356e034249b1e63020175f5f474c50ddb8e66b7d..bab26e6b3c8e7ffe929b1d238b372b5b46b1fba0 100644 --- a/test/vinyl/update_optimize.result +++ b/test/vinyl/update_optimize.result @@ -16,6 +16,9 @@ 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:info().disk.dump.out.rows + index2:info().disk.dump.out.rows end +--- +... box.snapshot() --- - ok @@ -42,7 +45,7 @@ index_run_count = index:info().run_count index2_run_count = index2:info().run_count --- ... -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() --- ... space:insert({1, 2, 3, 4, 5}) @@ -69,7 +72,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 8 @@ -115,7 +118,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 9 @@ -174,7 +177,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 3 @@ -214,6 +217,9 @@ 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:info().disk.dump.out.rows + index2:info().disk.dump.out.rows + index3:info().disk.dump.out.rows end +--- +... box.snapshot() --- - ok @@ -227,7 +233,7 @@ index2_run_count = index2:info().run_count index3_run_count = index3:info().run_count --- ... -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() --- ... space:insert({1, 2, 3, 4, 5}) @@ -253,7 +259,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 12 @@ -297,7 +303,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 15 @@ -340,7 +346,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 3 @@ -362,7 +368,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 3 @@ -384,7 +390,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 1 @@ -436,7 +442,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() --- ... _ = index:update({2}, {{'=', 65, 1000}}) @@ -450,7 +456,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 1 @@ -478,7 +484,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... new_stmt_count - old_stmt_count == 1 @@ -521,7 +527,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() --- ... index:update({20}, {{'=', -1, 500}}) @@ -535,7 +541,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() --- ... -- 3 = REPLACE in index1 and DELETE + REPLACE in index3. @@ -587,7 +593,7 @@ box.snapshot() index_run_count = wait_for_dump(index, index_run_count) --- ... -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() --- ... index:select{} diff --git a/test/vinyl/update_optimize.test.lua b/test/vinyl/update_optimize.test.lua index 99b22e41d9e00317c343775af3c7d1060af5b85a..2916712d234e40a7bf96cfb4010cf31a800300d2 100644 --- a/test/vinyl/update_optimize.test.lua +++ b/test/vinyl/update_optimize.test.lua @@ -8,6 +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:info().disk.dump.out.rows + index2:info().disk.dump.out.rows end box.snapshot() test_run:cmd("setopt delimiter ';'") function wait_for_dump(index, old_count) @@ -20,7 +21,7 @@ test_run:cmd("setopt delimiter ''"); index_run_count = index:info().run_count index2_run_count = index2:info().run_count -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() space:insert({1, 2, 3, 4, 5}) space:insert({2, 3, 4, 5, 6}) space:insert({3, 4, 5, 6, 7}) @@ -28,7 +29,7 @@ space:insert({4, 5, 6, 7, 8}) box.snapshot() -- Wait for dump both indexes. index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 8 old_stmt_count = new_stmt_count -- not optimized updates @@ -45,7 +46,7 @@ index_run_count = wait_for_dump(index, index_run_count) space:update({1}, {{'#', 3, 1}}) -- same box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 9 old_stmt_count = new_stmt_count space:select{} @@ -62,7 +63,7 @@ index_run_count = wait_for_dump(index, index_run_count) space:update({2}, {{'#', 6, 1}}) -- same box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 3 old_stmt_count = new_stmt_count space:select{} @@ -75,18 +76,19 @@ 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:info().disk.dump.out.rows + index2:info().disk.dump.out.rows + index3:info().disk.dump.out.rows end box.snapshot() index_run_count = index:info().run_count index2_run_count = index2:info().run_count index3_run_count = index3:info().run_count -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() space:insert({1, 2, 3, 4, 5}) space:insert({2, 3, 4, 5, 6}) space:insert({3, 4, 5, 6, 7}) space:insert({4, 5, 6, 7, 8}) box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 12 old_stmt_count = new_stmt_count @@ -100,7 +102,7 @@ index_run_count = wait_for_dump(index, index_run_count) index:update({2}, {{'=', 7, 100}, {'+', 5, 10}, {'#', 3, 1}}) -- change two cols but then move range with all indexed fields box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 15 old_stmt_count = new_stmt_count space:select{} @@ -111,21 +113,21 @@ index3:select{} index:update({3}, {{'+', 1, 10}, {'-', 5, 2}, {'!', 6, 100}}) -- change only index 'third' box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 3 old_stmt_count = new_stmt_count -- optimize one 'third' index update index:update({3}, {{'=', 1, 20}, {'+', 3, 5}, {'=', 4, 30}, {'!', 6, 110}}) -- change only index 'secondary' box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 3 old_stmt_count = new_stmt_count -- optimize both indexes index:update({3}, {{'+', 1, 10}, {'#', 6, 1}}) -- don't change any indexed fields box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 1 old_stmt_count = new_stmt_count space:select{} @@ -143,13 +145,13 @@ box.snapshot() -- Make update of not indexed field with pos > 64. index_run_count = wait_for_dump(index, index_run_count) -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() _ = index:update({2}, {{'=', 65, 1000}}) box.snapshot() -- Check the only primary index to be changed. index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 1 old_stmt_count = new_stmt_count space:get{2}[65] @@ -160,7 +162,7 @@ space:get{2}[65] index:update({2}, {{'#', -65, 65}}) box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() new_stmt_count - old_stmt_count == 1 old_stmt_count = new_stmt_count index:select{} @@ -171,12 +173,12 @@ index3:select{} space:replace{10, 20, 30, 40, 50} box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() index:update({20}, {{'=', -1, 500}}) box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -new_stmt_count = box.info.vinyl().performance.dumped_statements +new_stmt_count = dumped_stmt_count() -- 3 = REPLACE in index1 and DELETE + REPLACE in index3. new_stmt_count - old_stmt_count == 3 old_stmt_count = new_stmt_count @@ -190,7 +192,7 @@ space:replace{10, 100, 1000, 10000, 100000, 1000000} index:update({100}, {{'=', 6, 1}}) box.snapshot() index_run_count = wait_for_dump(index, index_run_count) -old_stmt_count = box.info.vinyl().performance.dumped_statements +old_stmt_count = dumped_stmt_count() index:select{} index2:select{} index3:select{}