From: Vladimir Davydov <vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org Subject: [PATCH 04/12] vinyl: rename compact to compaction Date: Tue, 15 Jan 2019 17:17:13 +0300 [thread overview] Message-ID: <a3efe3513cd0bdfb4176cd746689fcecbc98eca8.1547558871.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1547558871.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1547558871.git.vdavydov.dev@gmail.com> compact_input sounds confusing, because 'compact' works as an adjective here. Saving 3 characters per variable/stat name related to compaction doesn't justify this. Let's rename 'compact' to 'compaction' both in stats and in the code. --- src/box/vinyl.c | 32 +++---- src/box/vy_lsm.c | 40 ++++----- src/box/vy_lsm.h | 12 +-- src/box/vy_range.c | 24 +++--- src/box/vy_range.h | 16 ++-- src/box/vy_scheduler.c | 102 +++++++++++----------- src/box/vy_scheduler.h | 6 +- src/box/vy_stat.h | 4 +- test/vinyl/ddl.result | 2 +- test/vinyl/ddl.test.lua | 2 +- test/vinyl/deferred_delete.result | 16 ++-- test/vinyl/deferred_delete.test.lua | 16 ++-- test/vinyl/errinj.result | 10 +-- test/vinyl/errinj.test.lua | 10 +-- test/vinyl/errinj_stat.result | 26 +++--- test/vinyl/errinj_stat.test.lua | 26 +++--- test/vinyl/snap_io_rate.result | 2 +- test/vinyl/snap_io_rate.test.lua | 2 +- test/vinyl/stat.result | 164 ++++++++++++++++++------------------ test/vinyl/stat.test.lua | 8 +- test/vinyl/write_iterator.result | 20 ++--- test/vinyl/write_iterator.test.lua | 20 ++--- 22 files changed, 282 insertions(+), 278 deletions(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index f6139898..8028fd2b 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -307,11 +307,11 @@ vy_info_append_disk(struct vy_env *env, struct info_handler *h) info_append_int(h, "output", stat->dump.output); info_table_end(h); /* dump */ - info_table_begin(h, "compact"); - 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 */ + info_table_begin(h, "compaction"); + info_append_int(h, "input", stat->compaction.input); + info_append_int(h, "output", stat->compaction.output); + info_append_int(h, "queue", stat->compaction.queue); + info_table_end(h); /* compaction */ info_table_end(h); /* disk */ } @@ -417,12 +417,12 @@ vinyl_index_stat(struct index *index, struct info_handler *h) 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, "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_table_begin(h, "compaction"); + info_append_int(h, "count", stat->disk.compaction.count); + vy_info_append_disk_stmt_counter(h, "input", &stat->disk.compaction.input); + vy_info_append_disk_stmt_counter(h, "output", &stat->disk.compaction.output); + vy_info_append_disk_stmt_counter(h, "queue", &stat->disk.compaction.queue); + info_table_end(h); /* compaction */ info_append_int(h, "index_size", lsm->page_index_size); info_append_int(h, "bloom_size", lsm->bloom_size); info_table_end(h); /* disk */ @@ -480,9 +480,9 @@ vinyl_index_reset_stat(struct index *index) vy_disk_stmt_counter_reset(&stat->disk.dump.output); /* Compaction */ - stat->disk.compact.count = 0; - vy_disk_stmt_counter_reset(&stat->disk.compact.input); - vy_disk_stmt_counter_reset(&stat->disk.compact.output); + stat->disk.compaction.count = 0; + vy_disk_stmt_counter_reset(&stat->disk.compaction.input); + vy_disk_stmt_counter_reset(&stat->disk.compaction.output); /* Cache */ cache_stat->lookup = 0; @@ -517,8 +517,8 @@ vinyl_engine_reset_stat(struct engine *engine) struct vy_disk_stat *disk_stat = &env->lsm_env.disk_stat; disk_stat->dump.input = 0; disk_stat->dump.output = 0; - disk_stat->compact.input = 0; - disk_stat->compact.output = 0; + disk_stat->compaction.input = 0; + disk_stat->compaction.output = 0; } /** }}} Introspection */ diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c index 69319174..abadab5c 100644 --- a/src/box/vy_lsm.c +++ b/src/box/vy_lsm.c @@ -188,7 +188,7 @@ vy_lsm_new(struct vy_lsm_env *lsm_env, struct vy_cache_env *cache_env, lsm->mem_format = format; tuple_format_ref(lsm->mem_format); lsm->in_dump.pos = UINT32_MAX; - lsm->in_compact.pos = UINT32_MAX; + lsm->in_compaction.pos = UINT32_MAX; lsm->space_id = index_def->space_id; lsm->index_id = index_def->iid; lsm->group_id = group_id; @@ -234,13 +234,13 @@ vy_lsm_delete(struct vy_lsm *lsm) { assert(lsm->refs == 0); assert(lsm->in_dump.pos == UINT32_MAX); - assert(lsm->in_compact.pos == UINT32_MAX); + assert(lsm->in_compaction.pos == UINT32_MAX); assert(vy_lsm_read_set_empty(&lsm->read_set)); assert(lsm->env->lsm_count > 0); lsm->env->lsm_count--; - lsm->env->disk_stat.compact.queue -= - lsm->stat.disk.compact.queue.bytes; + lsm->env->disk_stat.compaction.queue -= + lsm->stat.disk.compaction.queue.bytes; if (lsm->pk != NULL) vy_lsm_unref(lsm->pk); @@ -661,13 +661,13 @@ vy_lsm_generation(struct vy_lsm *lsm) } int -vy_lsm_compact_priority(struct vy_lsm *lsm) +vy_lsm_compaction_priority(struct vy_lsm *lsm) { struct heap_node *n = vy_range_heap_top(&lsm->range_heap); if (n == NULL) return 0; struct vy_range *range = container_of(n, struct vy_range, heap_node); - return range->compact_priority; + return range->compaction_priority; } void @@ -749,18 +749,18 @@ void vy_lsm_acct_range(struct vy_lsm *lsm, struct vy_range *range) { histogram_collect(lsm->run_hist, range->slice_count); - vy_disk_stmt_counter_add(&lsm->stat.disk.compact.queue, - &range->compact_queue); - lsm->env->disk_stat.compact.queue += range->compact_queue.bytes; + vy_disk_stmt_counter_add(&lsm->stat.disk.compaction.queue, + &range->compaction_queue); + lsm->env->disk_stat.compaction.queue += range->compaction_queue.bytes; } void vy_lsm_unacct_range(struct vy_lsm *lsm, struct vy_range *range) { histogram_discard(lsm->run_hist, range->slice_count); - vy_disk_stmt_counter_sub(&lsm->stat.disk.compact.queue, - &range->compact_queue); - lsm->env->disk_stat.compact.queue -= range->compact_queue.bytes; + vy_disk_stmt_counter_sub(&lsm->stat.disk.compaction.queue, + &range->compaction_queue); + lsm->env->disk_stat.compaction.queue -= range->compaction_queue.bytes; } void @@ -781,12 +781,12 @@ vy_lsm_acct_compaction(struct vy_lsm *lsm, 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.input, input); - vy_disk_stmt_counter_add(&lsm->stat.disk.compact.output, output); + lsm->stat.disk.compaction.count++; + vy_disk_stmt_counter_add(&lsm->stat.disk.compaction.input, input); + vy_disk_stmt_counter_add(&lsm->stat.disk.compaction.output, output); - lsm->env->disk_stat.compact.input += input->bytes; - lsm->env->disk_stat.compact.output += output->bytes; + lsm->env->disk_stat.compaction.input += input->bytes; + lsm->env->disk_stat.compaction.output += output->bytes; } int @@ -1061,7 +1061,7 @@ vy_lsm_split_range(struct vy_lsm *lsm, struct vy_range *range) vy_range_add_slice(part, new_slice); } part->needs_compaction = range->needs_compaction; - vy_range_update_compact_priority(part, &lsm->opts); + vy_range_update_compaction_priority(part, &lsm->opts); } /* @@ -1178,7 +1178,7 @@ vy_lsm_coalesce_range(struct vy_lsm *lsm, struct vy_range *range) * we don't need to compact the resulting range as long * as it fits the configured LSM tree shape. */ - vy_range_update_compact_priority(result, &lsm->opts); + vy_range_update_compaction_priority(result, &lsm->opts); vy_lsm_acct_range(lsm, result); vy_lsm_add_range(lsm, result); lsm->range_tree_version++; @@ -1206,7 +1206,7 @@ vy_lsm_force_compaction(struct vy_lsm *lsm) while ((range = vy_range_tree_inext(&it)) != NULL) { vy_lsm_unacct_range(lsm, range); range->needs_compaction = true; - vy_range_update_compact_priority(range, &lsm->opts); + vy_range_update_compaction_priority(range, &lsm->opts); vy_lsm_acct_range(lsm, range); } diff --git a/src/box/vy_lsm.h b/src/box/vy_lsm.h index 07dc1b5c..e7487995 100644 --- a/src/box/vy_lsm.h +++ b/src/box/vy_lsm.h @@ -221,7 +221,7 @@ struct vy_lsm { vy_range_tree_t *tree; /** Number of ranges in this LSM tree. */ int range_count; - /** Heap of ranges, prioritized by compact_priority. */ + /** Heap of ranges, prioritized by compaction_priority. */ heap_t range_heap; /** * List of all runs created for this LSM tree, @@ -276,8 +276,8 @@ struct vy_lsm { bool is_dumping; /** Link in vy_scheduler->dump_heap. */ struct heap_node in_dump; - /** Link in vy_scheduler->compact_heap. */ - struct heap_node in_compact; + /** Link in vy_scheduler->compaction_heap. */ + struct heap_node in_compaction; /** * Interval tree containing reads from this LSM tree done by * all active transactions. Linked by vy_tx_interval->in_lsm. @@ -404,9 +404,9 @@ vy_lsm_recover(struct vy_lsm *lsm, struct vy_recovery *recovery, int64_t vy_lsm_generation(struct vy_lsm *lsm); -/** Return max compact_priority among ranges of an LSM tree. */ +/** Return max compaction_priority among ranges of an LSM tree. */ int -vy_lsm_compact_priority(struct vy_lsm *lsm); +vy_lsm_compaction_priority(struct vy_lsm *lsm); /** Add a run to the list of runs of an LSM tree. */ void @@ -436,7 +436,7 @@ vy_lsm_remove_range(struct vy_lsm *lsm, struct vy_range *range); * This function updates the following LSM tree statistics: * - vy_lsm::run_hist after a slice is added to or removed from * a range of the LSM tree. - * - vy_lsm::stat::disk::compact::queue after compaction priority + * - vy_lsm::stat::disk::compaction::queue after compaction priority * of a range is updated. */ void diff --git a/src/box/vy_range.c b/src/box/vy_range.c index 4e24e2a3..f489c95d 100644 --- a/src/box/vy_range.c +++ b/src/box/vy_range.c @@ -282,18 +282,18 @@ vy_range_remove_slice(struct vy_range *range, struct vy_slice *slice) * ratio. * * Given a range, this function computes the maximal level that needs - * to be compacted and sets @compact_priority to the number of runs in - * this level and all preceding levels. + * to be compacted and sets @compaction_priority to the number of runs + * in this level and all preceding levels. */ void -vy_range_update_compact_priority(struct vy_range *range, - const struct index_opts *opts) +vy_range_update_compaction_priority(struct vy_range *range, + const struct index_opts *opts) { assert(opts->run_count_per_level > 0); assert(opts->run_size_ratio > 1); - range->compact_priority = 0; - vy_disk_stmt_counter_reset(&range->compact_queue); + range->compaction_priority = 0; + vy_disk_stmt_counter_reset(&range->compaction_queue); if (range->slice_count <= 1) { /* Nothing to compact. */ @@ -302,8 +302,8 @@ vy_range_update_compact_priority(struct vy_range *range, } if (range->needs_compaction) { - range->compact_priority = range->slice_count; - range->compact_queue = range->count; + range->compaction_priority = range->slice_count; + range->compaction_queue = range->count; return; } @@ -372,8 +372,8 @@ vy_range_update_compact_priority(struct vy_range *range, * for compaction. We compact all runs at * this level and upper levels. */ - range->compact_priority = total_run_count; - range->compact_queue = total_stmt_count; + range->compaction_priority = total_run_count; + range->compaction_queue = total_stmt_count; est_new_run_size = total_stmt_count.bytes_compressed; } } @@ -383,8 +383,8 @@ vy_range_update_compact_priority(struct vy_range *range, * Do not store more than one run at the last level * to keep space amplification low. */ - range->compact_priority = total_run_count; - range->compact_queue = total_stmt_count; + range->compaction_priority = total_run_count; + range->compaction_queue = total_stmt_count; } } diff --git a/src/box/vy_range.h b/src/box/vy_range.h index 0830479d..05195d08 100644 --- a/src/box/vy_range.h +++ b/src/box/vy_range.h @@ -103,15 +103,15 @@ struct vy_range { * The lower the level is scheduled for compaction, * the bigger it tends to be because upper levels are * taken in. - * @sa vy_range_update_compact_priority() to see + * @sa vy_range_update_compaction_priority() to see * how we decide how many runs to compact next time. */ - int compact_priority; + int compaction_priority; /** Number of statements that need to be compacted. */ - struct vy_disk_stmt_counter compact_queue; + struct vy_disk_stmt_counter compaction_queue; /** * If this flag is set, the range must be scheduled for - * major compaction, i.e. its compact_priority must be + * major compaction, i.e. its compaction_priority must be * raised to max (slice_count). The flag is set by * vy_lsm_force_compaction() and cleared when the range * is scheduled for compaction. @@ -132,7 +132,7 @@ struct vy_range { /** * Heap of all ranges of the same LSM tree, prioritized by - * vy_range->compact_priority. + * vy_range->compaction_priority. */ #define HEAP_NAME vy_range_heap static inline bool @@ -140,7 +140,7 @@ vy_range_heap_less(struct heap_node *a, struct heap_node *b) { struct vy_range *r1 = container_of(a, struct vy_range, heap_node); struct vy_range *r2 = container_of(b, struct vy_range, heap_node); - return r1->compact_priority > r2->compact_priority; + return r1->compaction_priority > r2->compaction_priority; } #define HEAP_LESS(h, l, r) vy_range_heap_less(l, r) #include "salad/heap.h" @@ -239,8 +239,8 @@ vy_range_remove_slice(struct vy_range *range, struct vy_slice *slice); * @param opts Index options. */ void -vy_range_update_compact_priority(struct vy_range *range, - const struct index_opts *opts); +vy_range_update_compaction_priority(struct vy_range *range, + const struct index_opts *opts); /** * Check if a range needs to be split in two. diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index 72d2094e..ba20ef53 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -315,19 +315,19 @@ vy_dump_heap_less(struct heap_node *a, struct heap_node *b) #undef HEAP_NAME static bool -vy_compact_heap_less(struct heap_node *a, struct heap_node *b) +vy_compaction_heap_less(struct heap_node *a, struct heap_node *b) { - struct vy_lsm *i1 = container_of(a, struct vy_lsm, in_compact); - struct vy_lsm *i2 = container_of(b, struct vy_lsm, in_compact); + struct vy_lsm *i1 = container_of(a, struct vy_lsm, in_compaction); + struct vy_lsm *i2 = container_of(b, struct vy_lsm, in_compaction); /* * Prefer LSM trees whose read amplification will be reduced * most as a result of compaction. */ - return vy_lsm_compact_priority(i1) > vy_lsm_compact_priority(i2); + return vy_lsm_compaction_priority(i1) > vy_lsm_compaction_priority(i2); } -#define HEAP_NAME vy_compact_heap -#define HEAP_LESS(h, l, r) vy_compact_heap_less(l, r) +#define HEAP_NAME vy_compaction_heap +#define HEAP_LESS(h, l, r) vy_compaction_heap_less(l, r) #include "salad/heap.h" @@ -459,16 +459,16 @@ vy_scheduler_create(struct vy_scheduler *scheduler, int write_threads, */ assert(write_threads > 1); int dump_threads = MAX(1, write_threads / 4); - int compact_threads = write_threads - dump_threads; + int compaction_threads = write_threads - dump_threads; vy_worker_pool_create(&scheduler->dump_pool, "dump", dump_threads); - vy_worker_pool_create(&scheduler->compact_pool, - "compact", compact_threads); + vy_worker_pool_create(&scheduler->compaction_pool, + "compaction", compaction_threads); stailq_create(&scheduler->processed_tasks); vy_dump_heap_create(&scheduler->dump_heap); - vy_compact_heap_create(&scheduler->compact_heap); + vy_compaction_heap_create(&scheduler->compaction_heap); diag_create(&scheduler->diag); fiber_cond_create(&scheduler->dump_cond); @@ -490,12 +490,12 @@ vy_scheduler_destroy(struct vy_scheduler *scheduler) fiber_cond_signal(&scheduler->scheduler_cond); vy_worker_pool_destroy(&scheduler->dump_pool); - vy_worker_pool_destroy(&scheduler->compact_pool); + vy_worker_pool_destroy(&scheduler->compaction_pool); diag_destroy(&scheduler->diag); fiber_cond_destroy(&scheduler->dump_cond); fiber_cond_destroy(&scheduler->scheduler_cond); vy_dump_heap_destroy(&scheduler->dump_heap); - vy_compact_heap_destroy(&scheduler->compact_heap); + vy_compaction_heap_destroy(&scheduler->compaction_heap); TRASH(scheduler); } @@ -504,20 +504,22 @@ void vy_scheduler_add_lsm(struct vy_scheduler *scheduler, struct vy_lsm *lsm) { assert(lsm->in_dump.pos == UINT32_MAX); - assert(lsm->in_compact.pos == UINT32_MAX); + assert(lsm->in_compaction.pos == UINT32_MAX); vy_dump_heap_insert(&scheduler->dump_heap, &lsm->in_dump); - vy_compact_heap_insert(&scheduler->compact_heap, &lsm->in_compact); + vy_compaction_heap_insert(&scheduler->compaction_heap, + &lsm->in_compaction); } void vy_scheduler_remove_lsm(struct vy_scheduler *scheduler, struct vy_lsm *lsm) { assert(lsm->in_dump.pos != UINT32_MAX); - assert(lsm->in_compact.pos != UINT32_MAX); + assert(lsm->in_compaction.pos != UINT32_MAX); vy_dump_heap_delete(&scheduler->dump_heap, &lsm->in_dump); - vy_compact_heap_delete(&scheduler->compact_heap, &lsm->in_compact); + vy_compaction_heap_delete(&scheduler->compaction_heap, + &lsm->in_compaction); lsm->in_dump.pos = UINT32_MAX; - lsm->in_compact.pos = UINT32_MAX; + lsm->in_compaction.pos = UINT32_MAX; } static void @@ -526,13 +528,14 @@ vy_scheduler_update_lsm(struct vy_scheduler *scheduler, struct vy_lsm *lsm) if (lsm->is_dropped) { /* Dropped LSM trees are exempted from scheduling. */ assert(lsm->in_dump.pos == UINT32_MAX); - assert(lsm->in_compact.pos == UINT32_MAX); + assert(lsm->in_compaction.pos == UINT32_MAX); return; } assert(lsm->in_dump.pos != UINT32_MAX); - assert(lsm->in_compact.pos != UINT32_MAX); + assert(lsm->in_compaction.pos != UINT32_MAX); vy_dump_heap_update(&scheduler->dump_heap, &lsm->in_dump); - vy_compact_heap_update(&scheduler->compact_heap, &lsm->in_compact); + vy_compaction_heap_update(&scheduler->compaction_heap, + &lsm->in_compaction); } static void @@ -1200,7 +1203,7 @@ vy_task_dump_complete(struct vy_task *task) slice = new_slices[i]; vy_lsm_unacct_range(lsm, range); vy_range_add_slice(range, slice); - vy_range_update_compact_priority(range, &lsm->opts); + vy_range_update_compaction_priority(range, &lsm->opts); vy_lsm_acct_range(lsm, range); if (!vy_range_is_scheduled(range)) vy_range_heap_update(&lsm->range_heap, @@ -1427,7 +1430,7 @@ err: } static int -vy_task_compact_execute(struct vy_task *task) +vy_task_compaction_execute(struct vy_task *task) { struct errinj *errinj = errinj(ERRINJ_VY_COMPACTION_DELAY, ERRINJ_BOOL); if (errinj != NULL && errinj->bparam) { @@ -1438,14 +1441,14 @@ vy_task_compact_execute(struct vy_task *task) } static int -vy_task_compact_complete(struct vy_task *task) +vy_task_compaction_complete(struct vy_task *task) { struct vy_scheduler *scheduler = task->scheduler; 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_output = new_run->count; - struct vy_disk_stmt_counter compact_input; + struct vy_disk_stmt_counter compaction_output = new_run->count; + struct vy_disk_stmt_counter compaction_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,20 +1550,20 @@ 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_input); + vy_disk_stmt_counter_reset(&compaction_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_input, &slice->count); + vy_disk_stmt_counter_add(&compaction_input, &slice->count); if (slice == last_slice) break; } range->n_compactions++; range->version++; - vy_range_update_compact_priority(range, &lsm->opts); + vy_range_update_compaction_priority(range, &lsm->opts); vy_lsm_acct_range(lsm, range); - vy_lsm_acct_compaction(lsm, &compact_input, &compact_output); + vy_lsm_acct_compaction(lsm, &compaction_input, &compaction_output); /* * Unaccount unused runs and delete compacted slices. @@ -1586,7 +1589,7 @@ vy_task_compact_complete(struct vy_task *task) } static void -vy_task_compact_abort(struct vy_task *task) +vy_task_compaction_abort(struct vy_task *task) { struct vy_scheduler *scheduler = task->scheduler; struct vy_lsm *lsm = task->lsm; @@ -1614,13 +1617,13 @@ vy_task_compact_abort(struct vy_task *task) } static int -vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, - struct vy_lsm *lsm, struct vy_task **p_task) +vy_task_compaction_new(struct vy_scheduler *scheduler, struct vy_worker *worker, + struct vy_lsm *lsm, struct vy_task **p_task) { - static struct vy_task_ops compact_ops = { - .execute = vy_task_compact_execute, - .complete = vy_task_compact_complete, - .abort = vy_task_compact_abort, + static struct vy_task_ops compaction_ops = { + .execute = vy_task_compaction_execute, + .complete = vy_task_compaction_complete, + .abort = vy_task_compaction_abort, }; struct heap_node *range_node; @@ -1631,7 +1634,7 @@ vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, range_node = vy_range_heap_top(&lsm->range_heap); assert(range_node != NULL); range = container_of(range_node, struct vy_range, heap_node); - assert(range->compact_priority > 1); + assert(range->compaction_priority > 1); if (vy_lsm_split_range(lsm, range) || vy_lsm_coalesce_range(lsm, range)) { @@ -1639,7 +1642,8 @@ vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, return 0; } - struct vy_task *task = vy_task_new(scheduler, worker, lsm, &compact_ops); + struct vy_task *task = vy_task_new(scheduler, worker, lsm, + &compaction_ops); if (task == NULL) goto err_task; @@ -1648,7 +1652,7 @@ vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, goto err_run; struct vy_stmt_stream *wi; - bool is_last_level = (range->compact_priority == range->slice_count); + bool is_last_level = (range->compaction_priority == range->slice_count); wi = vy_write_iterator_new(task->cmp_def, lsm->disk_format, lsm->index_id == 0, is_last_level, scheduler->read_views, @@ -1658,7 +1662,7 @@ vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, goto err_wi; struct vy_slice *slice; - int n = range->compact_priority; + int n = range->compaction_priority; rlist_foreach_entry(slice, &range->slices, in_range) { if (vy_write_iterator_new_slice(wi, slice) != 0) goto err_wi_sub; @@ -1693,7 +1697,7 @@ vy_task_compact_new(struct vy_scheduler *scheduler, struct vy_worker *worker, say_info("%s: started compacting range %s, runs %d/%d", vy_lsm_name(lsm), vy_range_str(range), - range->compact_priority, range->slice_count); + range->compaction_priority, range->slice_count); *p_task = task; return 0; @@ -1867,24 +1871,24 @@ no_task: * Returns 0 on success, -1 on failure. */ static int -vy_scheduler_peek_compact(struct vy_scheduler *scheduler, - struct vy_task **ptask) +vy_scheduler_peek_compaction(struct vy_scheduler *scheduler, + struct vy_task **ptask) { struct vy_worker *worker = NULL; retry: *ptask = NULL; - struct heap_node *pn = vy_compact_heap_top(&scheduler->compact_heap); + struct heap_node *pn = vy_compaction_heap_top(&scheduler->compaction_heap); if (pn == NULL) goto no_task; /* nothing to do */ - struct vy_lsm *lsm = container_of(pn, struct vy_lsm, in_compact); - if (vy_lsm_compact_priority(lsm) <= 1) + struct vy_lsm *lsm = container_of(pn, struct vy_lsm, in_compaction); + if (vy_lsm_compaction_priority(lsm) <= 1) goto no_task; /* nothing to do */ if (worker == NULL) { - worker = vy_worker_pool_get(&scheduler->compact_pool); + worker = vy_worker_pool_get(&scheduler->compaction_pool); if (worker == NULL) return 0; /* all workers are busy */ } - if (vy_task_compact_new(scheduler, worker, lsm, ptask) != 0) { + if (vy_task_compaction_new(scheduler, worker, lsm, ptask) != 0) { vy_worker_pool_put(worker); return -1; } @@ -1907,7 +1911,7 @@ vy_schedule(struct vy_scheduler *scheduler, struct vy_task **ptask) if (*ptask != NULL) return 0; - if (vy_scheduler_peek_compact(scheduler, ptask) != 0) + if (vy_scheduler_peek_compaction(scheduler, ptask) != 0) goto fail; if (*ptask != NULL) return 0; diff --git a/src/box/vy_scheduler.h b/src/box/vy_scheduler.h index 96ce721b..5b09f964 100644 --- a/src/box/vy_scheduler.h +++ b/src/box/vy_scheduler.h @@ -75,7 +75,7 @@ struct vy_scheduler { /** Pool of threads for performing background dumps. */ struct vy_worker_pool dump_pool; /** Pool of threads for performing background compactions. */ - struct vy_worker_pool compact_pool; + struct vy_worker_pool compaction_pool; /** Queue of processed tasks, linked by vy_task::in_processed. */ struct stailq processed_tasks; /** @@ -85,9 +85,9 @@ struct vy_scheduler { heap_t dump_heap; /** * Heap of LSM trees, ordered by compaction priority, - * linked by vy_lsm::in_compact. + * linked by vy_lsm::in_compaction. */ - heap_t compact_heap; + heap_t compaction_heap; /** Last error seen by the scheduler. */ struct diag diag; /** diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h index ae032d1d..7ed55ff5 100644 --- a/src/box/vy_stat.h +++ b/src/box/vy_stat.h @@ -162,7 +162,7 @@ struct vy_lsm_stat { struct vy_disk_stmt_counter output; /** Number of statements awaiting compaction. */ struct vy_disk_stmt_counter queue; - } compact; + } compaction; } disk; /** TX write set statistics. */ struct { @@ -222,7 +222,7 @@ struct vy_disk_stat { int64_t input; int64_t output; int64_t queue; - } compact; + } compaction; }; static inline int diff --git a/test/vinyl/ddl.result b/test/vinyl/ddl.result index dbffc3e5..68bb6b3a 100644 --- a/test/vinyl/ddl.result +++ b/test/vinyl/ddl.result @@ -110,7 +110,7 @@ box.snapshot() - ok ... -- wait for compaction to complete -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.01) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end --- ... pk:alter{parts = {2, 'unsigned'}} -- success: space is empty now diff --git a/test/vinyl/ddl.test.lua b/test/vinyl/ddl.test.lua index 7c504046..9b870f35 100644 --- a/test/vinyl/ddl.test.lua +++ b/test/vinyl/ddl.test.lua @@ -36,7 +36,7 @@ space:delete{2} pk:alter{parts = {2, 'unsigned'}} -- error: mem/run not empty box.snapshot() -- wait for compaction to complete -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.01) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end pk:alter{parts = {2, 'unsigned'}} -- success: space is empty now space:replace{1, 2} -- gh-3508 - Altering primary index of a vinyl space doesn't work as expected diff --git a/test/vinyl/deferred_delete.result b/test/vinyl/deferred_delete.result index 5a432d07..29945f8d 100644 --- a/test/vinyl/deferred_delete.result +++ b/test/vinyl/deferred_delete.result @@ -150,7 +150,7 @@ box.snapshot() pk:compact() --- ... -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... pk:stat().rows -- 5 new REPLACEs @@ -237,13 +237,13 @@ box.snapshot() i1:compact() --- ... -while i1:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while i1:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... i2:compact() --- ... -while i2:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while i2:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... i1:stat().rows -- 5 new REPLACEs @@ -427,7 +427,7 @@ box.snapshot() sk:compact() --- ... -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... sk:stat().run_count -- 0 @@ -549,7 +549,7 @@ box.snapshot() pk:compact() --- ... -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -- Compact the secondary index to cleanup garbage. @@ -560,7 +560,7 @@ box.snapshot() sk:compact() --- ... -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... sk:select() @@ -628,7 +628,7 @@ box.snapshot() pk:compact() --- ... -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... sk:select() -- [1, 10, 'c'] @@ -725,7 +725,7 @@ box.stat.reset() pk:compact() --- ... -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... sk:stat().disk.dump.count -- 1 diff --git a/test/vinyl/deferred_delete.test.lua b/test/vinyl/deferred_delete.test.lua index 53f75a03..d38802da 100644 --- a/test/vinyl/deferred_delete.test.lua +++ b/test/vinyl/deferred_delete.test.lua @@ -57,7 +57,7 @@ box.cfg{vinyl_cache = vinyl_cache} -- Compact the primary index to generate deferred DELETEs. box.snapshot() pk:compact() -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end pk:stat().rows -- 5 new REPLACEs i1:stat().rows -- 10 old REPLACE + 5 new REPLACEs + 10 deferred DELETEs i2:stat().rows -- ditto @@ -87,9 +87,9 @@ i2:stat().rows -- ditto -- Check that they cleanup garbage statements. box.snapshot() i1:compact() -while i1:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while i1:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end i2:compact() -while i2:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while i2:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end i1:stat().rows -- 5 new REPLACEs i2:stat().rows -- ditto box.stat.reset() @@ -151,7 +151,7 @@ box.stat.vinyl().memory.tx box.snapshot() sk:compact() -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end sk:stat().run_count -- 0 s:drop() @@ -201,12 +201,12 @@ sk:stat().rows -- 10 old REPLACEs + 5 new REPLACEs -- Compact the primary index to generate deferred DELETEs. box.snapshot() pk:compact() -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end -- Compact the secondary index to cleanup garbage. box.snapshot() sk:compact() -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end sk:select() @@ -234,7 +234,7 @@ box.snapshot() -- Generate deferred DELETEs. pk:compact() -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end sk:select() -- [1, 10, 'c'] box.snapshot() @@ -280,7 +280,7 @@ box.stat.reset() -- Deferred DELETEs won't fit in memory and trigger dump -- of the secondary index. pk:compact() -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end sk:stat().disk.dump.count -- 1 diff --git a/test/vinyl/errinj.result b/test/vinyl/errinj.result index a16475f5..4a3df6ae 100644 --- a/test/vinyl/errinj.result +++ b/test/vinyl/errinj.result @@ -497,7 +497,7 @@ box.snapshot() - ok ... -- --- Check that all dump/compact tasks that are in progress at +-- Check that all dump/compaction tasks that are in progress at -- the time when the server stops are aborted immediately. -- s = box.schema.space.create('test', {engine = 'vinyl'}) @@ -961,7 +961,7 @@ c = fiber.channel(1) _ = fiber.create(function() box.snapshot() c:put(true) end) --- ... -while s.index.pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while s.index.pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... errinj.set('ERRINJ_SNAP_COMMIT_DELAY', false) @@ -1049,7 +1049,7 @@ s.index.pk:compact() while box.stat.ERROR.total - errors == 0 do fiber.sleep(0.001) end --- ... -s.index.pk:stat().disk.compact.count -- 0 +s.index.pk:stat().disk.compaction.count -- 0 --- - 0 ... @@ -1057,10 +1057,10 @@ errinj.set("ERRINJ_WAL_IO", false) --- - ok ... -while s.index.pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while s.index.pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -s.index.pk:stat().disk.compact.count -- 1 +s.index.pk:stat().disk.compaction.count -- 1 --- - 1 ... diff --git a/test/vinyl/errinj.test.lua b/test/vinyl/errinj.test.lua index d4590fb4..c9d04aaf 100644 --- a/test/vinyl/errinj.test.lua +++ b/test/vinyl/errinj.test.lua @@ -179,7 +179,7 @@ box.error.injection.set('ERRINJ_VY_RUN_WRITE_DELAY', false) box.snapshot() -- --- Check that all dump/compact tasks that are in progress at +-- Check that all dump/compaction tasks that are in progress at -- the time when the server stops are aborted immediately. -- s = box.schema.space.create('test', {engine = 'vinyl'}) @@ -348,7 +348,7 @@ _ = s:replace{2} errinj.set('ERRINJ_SNAP_COMMIT_DELAY', true) c = fiber.channel(1) _ = fiber.create(function() box.snapshot() c:put(true) end) -while s.index.pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while s.index.pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end errinj.set('ERRINJ_SNAP_COMMIT_DELAY', false) c:get() -- Check that all files corresponding to the last checkpoint @@ -381,10 +381,10 @@ errinj.set("ERRINJ_WAL_IO", true) errors = box.stat.ERROR.total s.index.pk:compact() while box.stat.ERROR.total - errors == 0 do fiber.sleep(0.001) end -s.index.pk:stat().disk.compact.count -- 0 +s.index.pk:stat().disk.compaction.count -- 0 errinj.set("ERRINJ_WAL_IO", false) -while s.index.pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end -s.index.pk:stat().disk.compact.count -- 1 +while s.index.pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end +s.index.pk:stat().disk.compaction.count -- 1 errinj.set("ERRINJ_VY_SCHED_TIMEOUT", 0) box.snapshot() -- ok diff --git a/test/vinyl/errinj_stat.result b/test/vinyl/errinj_stat.result index fac56cee..9d7f64e9 100644 --- a/test/vinyl/errinj_stat.result +++ b/test/vinyl/errinj_stat.result @@ -29,7 +29,7 @@ errinj = box.error.injection --- ... -- --- Check disk.compact.queue stat. +-- Check disk.compaction.queue stat. -- s = box.schema.space.create('test', {engine = 'vinyl'}) --- @@ -43,14 +43,14 @@ function dump() for i = 1, 10 do s:replace{i} end box.snapshot() end dump() --- ... -i:stat().disk.compact.queue -- none +i:stat().disk.compaction.queue -- none --- - bytes_compressed: <bytes_compressed> pages: 0 rows: 0 bytes: 0 ... -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue --- - true ... @@ -64,56 +64,56 @@ dump() dump() --- ... -i:stat().disk.compact.queue -- 30 statements +i:stat().disk.compaction.queue -- 30 statements --- - bytes_compressed: <bytes_compressed> pages: 3 rows: 30 bytes: 411 ... -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue --- - true ... dump() --- ... -i:stat().disk.compact.queue -- 40 statements +i:stat().disk.compaction.queue -- 40 statements --- - bytes_compressed: <bytes_compressed> pages: 4 rows: 40 bytes: 548 ... -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue --- - true ... dump() --- ... -i:stat().disk.compact.queue -- 50 statements +i:stat().disk.compaction.queue -- 50 statements --- - bytes_compressed: <bytes_compressed> pages: 5 rows: 50 bytes: 685 ... -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue --- - true ... box.stat.reset() -- doesn't affect queue size --- ... -i:stat().disk.compact.queue -- 50 statements +i:stat().disk.compaction.queue -- 50 statements --- - bytes_compressed: <bytes_compressed> pages: 5 rows: 50 bytes: 685 ... -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue --- - true ... @@ -121,10 +121,10 @@ errinj.set('ERRINJ_VY_COMPACTION_DELAY', false) --- - ok ... -while i:stat().disk.compact.count < 2 do fiber.sleep(0.01) end +while i:stat().disk.compaction.count < 2 do fiber.sleep(0.01) end --- ... -i:stat().disk.compact.queue -- none +i:stat().disk.compaction.queue -- none --- - bytes_compressed: <bytes_compressed> pages: 0 diff --git a/test/vinyl/errinj_stat.test.lua b/test/vinyl/errinj_stat.test.lua index 1e0e63ae..6cd95cf9 100644 --- a/test/vinyl/errinj_stat.test.lua +++ b/test/vinyl/errinj_stat.test.lua @@ -15,31 +15,31 @@ fiber = require('fiber') errinj = box.error.injection -- --- Check disk.compact.queue stat. +-- Check disk.compaction.queue stat. -- s = box.schema.space.create('test', {engine = 'vinyl'}) i = s:create_index('pk', {run_count_per_level = 2}) function dump() for i = 1, 10 do s:replace{i} end box.snapshot() end dump() -i:stat().disk.compact.queue -- none -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue -- none +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue errinj.set('ERRINJ_VY_COMPACTION_DELAY', true) dump() dump() -i:stat().disk.compact.queue -- 30 statements -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue -- 30 statements +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue dump() -i:stat().disk.compact.queue -- 40 statements -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue -- 40 statements +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue dump() -i:stat().disk.compact.queue -- 50 statements -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue -- 50 statements +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue box.stat.reset() -- doesn't affect queue size -i:stat().disk.compact.queue -- 50 statements -i:stat().disk.compact.queue.bytes == box.stat.vinyl().disk.compact.queue +i:stat().disk.compaction.queue -- 50 statements +i:stat().disk.compaction.queue.bytes == box.stat.vinyl().disk.compaction.queue errinj.set('ERRINJ_VY_COMPACTION_DELAY', false) -while i:stat().disk.compact.count < 2 do fiber.sleep(0.01) end -i:stat().disk.compact.queue -- none +while i:stat().disk.compaction.count < 2 do fiber.sleep(0.01) end +i:stat().disk.compaction.queue -- none s:drop() test_run:cmd("clear filter") diff --git a/test/vinyl/snap_io_rate.result b/test/vinyl/snap_io_rate.result index 073c9ff9..2390e139 100644 --- a/test/vinyl/snap_io_rate.result +++ b/test/vinyl/snap_io_rate.result @@ -86,7 +86,7 @@ box.snapshot() --- - ok ... -while s.index.primary:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while s.index.primary:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... t2 = fiber.time() diff --git a/test/vinyl/snap_io_rate.test.lua b/test/vinyl/snap_io_rate.test.lua index 27e88e6b..5a09bfd9 100644 --- a/test/vinyl/snap_io_rate.test.lua +++ b/test/vinyl/snap_io_rate.test.lua @@ -37,7 +37,7 @@ rate < box.cfg.snap_io_rate_limit or rate fill() t1 = fiber.time() box.snapshot() -while s.index.primary:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while s.index.primary:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end t2 = fiber.time() -- dump + compaction => multiply by 2 diff --git a/test/vinyl/stat.result b/test/vinyl/stat.result index 315a5853..68aea30b 100644 --- a/test/vinyl/stat.result +++ b/test/vinyl/stat.result @@ -150,7 +150,23 @@ istat() bytes: 0 disk: index_size: 0 - rows: 0 + compaction: + 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 statement: inserts: 0 replaces: 0 @@ -166,40 +182,24 @@ istat() pages: 0 rows: 0 bytes: 0 - compact: - 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 - iterator: - read: - bytes_compressed: 0 - pages: 0 - rows: 0 - bytes: 0 - bloom: - hit: 0 - miss: 0 - lookup: 0 - get: - rows: 0 - bytes: 0 bloom_size: 0 + iterator: + read: + bytes_compressed: 0 + pages: 0 + rows: 0 + bytes: 0 + bloom: + hit: 0 + miss: 0 + lookup: 0 + get: + rows: 0 + bytes: 0 + bytes: 0 pages: 0 bytes_compressed: 0 - bytes: 0 + rows: 0 txw: bytes: 0 rows: 0 @@ -228,7 +228,7 @@ gstat() dump: input: 0 output: 0 - compact: + compaction: input: 0 output: 0 queue: 0 @@ -291,12 +291,12 @@ stat_diff(istat(), st) rows: 25 index_size: 294 rows: 25 - bytes: 26049 bytes_compressed: <bytes_compressed> - bloom_size: 70 - statement: - replaces: 25 pages: 7 + bloom_size: 70 + statement: + replaces: 25 + bytes: 26049 bytes: 26049 put: rows: 25 @@ -313,7 +313,7 @@ box.snapshot() --- - ok ... -wait(istat, st, 'disk.compact.count', 1) +wait(istat, st, 'disk.compaction.count', 1) --- ... stat_diff(istat(), st) @@ -330,13 +330,7 @@ stat_diff(istat(), st) bytes_compressed: <bytes_compressed> rows: 50 index_size: 252 - rows: 25 - bytes: 26042 - bytes_compressed: <bytes_compressed> - pages: 6 - statement: - replaces: 25 - compact: + compaction: input: bytes: 78140 pages: 20 @@ -348,6 +342,12 @@ stat_diff(istat(), st) pages: 13 bytes_compressed: <bytes_compressed> rows: 50 + rows: 25 + bytes_compressed: <bytes_compressed> + pages: 6 + statement: + replaces: 25 + bytes: 26042 put: rows: 50 bytes: 53050 @@ -572,7 +572,7 @@ box.snapshot() --- - ok ... -wait(istat, st, 'disk.compact.count', 2) +wait(istat, st, 'disk.compaction.count', 2) --- ... st = istat() @@ -709,11 +709,11 @@ gstat().disk.dump.output == istat().disk.dump.output.bytes --- - true ... -gstat().disk.compact.input == istat().disk.compact.input.bytes +gstat().disk.compaction.input == istat().disk.compaction.input.bytes --- - true ... -gstat().disk.compact.output == istat().disk.compact.output.bytes +gstat().disk.compaction.output == istat().disk.compaction.output.bytes --- - true ... @@ -1000,7 +1000,23 @@ istat() bytes: 0 disk: index_size: 1050 - rows: 100 + compaction: + input: + bytes_compressed: <bytes_compressed> + pages: 0 + rows: 0 + bytes: 0 + count: 0 + output: + bytes_compressed: <bytes_compressed> + pages: 0 + rows: 0 + bytes: 0 + queue: + bytes_compressed: <bytes_compressed> + pages: 0 + rows: 0 + bytes: 0 statement: inserts: 0 replaces: 100 @@ -1016,40 +1032,24 @@ istat() pages: 0 rows: 0 bytes: 0 - compact: - input: - bytes_compressed: <bytes_compressed> - pages: 0 - rows: 0 - bytes: 0 - count: 0 - output: - bytes_compressed: <bytes_compressed> - pages: 0 - rows: 0 - bytes: 0 - queue: - bytes_compressed: <bytes_compressed> - pages: 0 - rows: 0 - bytes: 0 - iterator: - read: - bytes_compressed: <bytes_compressed> - pages: 0 - rows: 0 - bytes: 0 - bloom: - hit: 0 - miss: 0 - lookup: 0 - get: - rows: 0 - bytes: 0 bloom_size: 140 - pages: 25 - bytes_compressed: <bytes_compressed> + iterator: + read: + bytes_compressed: <bytes_compressed> + pages: 0 + rows: 0 + bytes: 0 + bloom: + hit: 0 + miss: 0 + lookup: 0 + get: + rows: 0 + bytes: 0 bytes: 104300 + pages: 25 + bytes_compressed: <bytes_compressed> + rows: 100 txw: bytes: 0 rows: 0 @@ -1078,7 +1078,7 @@ gstat() dump: input: 0 output: 0 - compact: + compaction: input: 0 output: 0 queue: 0 diff --git a/test/vinyl/stat.test.lua b/test/vinyl/stat.test.lua index 56e544d1..0173cf89 100644 --- a/test/vinyl/stat.test.lua +++ b/test/vinyl/stat.test.lua @@ -118,7 +118,7 @@ stat_diff(istat(), st) st = istat() for i = 1, 100, 2 do put(i) end box.snapshot() -wait(istat, st, 'disk.compact.count', 1) +wait(istat, st, 'disk.compaction.count', 1) stat_diff(istat(), st) -- point lookup from disk + cache put @@ -174,7 +174,7 @@ stat_diff(istat(), st, 'cache') for i = 1, 100 do put(i) end st = istat() box.snapshot() -wait(istat, st, 'disk.compact.count', 2) +wait(istat, st, 'disk.compaction.count', 2) st = istat() st.range_count -- 2 st.run_count -- 2 @@ -207,8 +207,8 @@ box.rollback() -- dump and compaction totals 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 +gstat().disk.compaction.input == istat().disk.compaction.input.bytes +gstat().disk.compaction.output == istat().disk.compaction.output.bytes -- use memory st = gstat() diff --git a/test/vinyl/write_iterator.result b/test/vinyl/write_iterator.result index e6bf1b01..88a1c287 100644 --- a/test/vinyl/write_iterator.result +++ b/test/vinyl/write_iterator.result @@ -838,27 +838,27 @@ box.snapshot() - ok ... -- Wait for compaction. -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -pk:stat().disk.compact.count -- 1 +pk:stat().disk.compaction.count -- 1 --- - 1 ... -sk:stat().disk.compact.count -- 1 +sk:stat().disk.compaction.count -- 1 --- - 1 ... -- All INSERT+DELETE pairs should have been annihilated, -- only padding is left. -pk:stat().disk.compact.output.rows - PAD2 -- 0 +pk:stat().disk.compaction.output.rows - PAD2 -- 0 --- - 0 ... -sk:stat().disk.compact.output.rows - PAD2 -- 0 +sk:stat().disk.compaction.output.rows - PAD2 -- 0 --- - 0 ... @@ -985,17 +985,17 @@ box.snapshot() - ok ... -- Wait for compaction. -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end --- ... -pk:stat().disk.compact.count -- 1 +pk:stat().disk.compaction.count -- 1 --- - 1 ... -sk:stat().disk.compact.count -- 1 +sk:stat().disk.compaction.count -- 1 --- - 1 ... diff --git a/test/vinyl/write_iterator.test.lua b/test/vinyl/write_iterator.test.lua index a4ba42aa..069c7f69 100644 --- a/test/vinyl/write_iterator.test.lua +++ b/test/vinyl/write_iterator.test.lua @@ -355,14 +355,14 @@ s:delete{8} for i = 1001, 1000 + PAD2 do s:replace{i, i} end box.snapshot() -- Wait for compaction. -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end -pk:stat().disk.compact.count -- 1 -sk:stat().disk.compact.count -- 1 +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end +pk:stat().disk.compaction.count -- 1 +sk:stat().disk.compaction.count -- 1 -- All INSERT+DELETE pairs should have been annihilated, -- only padding is left. -pk:stat().disk.compact.output.rows - PAD2 -- 0 -sk:stat().disk.compact.output.rows - PAD2 -- 0 +pk:stat().disk.compaction.output.rows - PAD2 -- 0 +sk:stat().disk.compaction.output.rows - PAD2 -- 0 pk:select(1000, {iterator = 'LE'}) -- empty sk:select(1000, {iterator = 'LE'}) -- empty s:drop() @@ -408,10 +408,10 @@ s:delete{8} for i = 1001, 1000 + PAD2 do s:replace{i, i} end box.snapshot() -- Wait for compaction. -while pk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end -while sk:stat().disk.compact.count == 0 do fiber.sleep(0.001) end -pk:stat().disk.compact.count -- 1 -sk:stat().disk.compact.count -- 1 +while pk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end +while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end +pk:stat().disk.compaction.count -- 1 +sk:stat().disk.compaction.count -- 1 -- If INSERT+DELETE statements stored in the two compacted runs -- were annihilated we would see tuples stored in the first run. pk:select(1000, {iterator = 'LE'}) -- empty -- 2.11.0
next prev parent reply other threads:[~2019-01-15 14:17 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-15 14:17 [PATCH 00/12] vinyl: statistics improvements Vladimir Davydov 2019-01-15 14:17 ` [PATCH 01/12] test: rename vinyl/info to vinyl/stat Vladimir Davydov 2019-01-17 11:32 ` [tarantool-patches] " Konstantin Osipov 2019-01-15 14:17 ` [PATCH 02/12] test: split vinyl/errinj Vladimir Davydov 2019-01-17 11:33 ` [tarantool-patches] " Konstantin Osipov 2019-01-15 14:17 ` [PATCH 03/12] vinyl: rename dump/compact in/out to input/output Vladimir Davydov 2019-01-17 11:33 ` [tarantool-patches] " Konstantin Osipov 2019-01-15 14:17 ` Vladimir Davydov [this message] 2019-01-17 11:34 ` [tarantool-patches] Re: [PATCH 04/12] vinyl: rename compact to compaction Konstantin Osipov 2019-01-17 12:08 ` Vladimir Davydov 2019-01-17 13:51 ` Konstantin Osipov 2019-01-15 14:17 ` [PATCH 05/12] vinyl: bump range version in vy_range.c Vladimir Davydov 2019-01-15 14:17 ` [PATCH 06/12] vinyl: don't add dropped LSM trees to the scheduler during recovery Vladimir Davydov 2019-01-15 14:17 ` [PATCH 07/12] vinyl: move global dump/compaction statistics to scheduler Vladimir Davydov 2019-01-16 16:36 ` Vladimir Davydov 2019-01-15 14:17 ` [PATCH 08/12] vinyl: add dump count to global scheduler statistics Vladimir Davydov 2019-01-15 14:17 ` [PATCH 09/12] vinyl: don't account secondary indexes to scheduler.dump_input Vladimir Davydov 2019-01-15 14:17 ` [PATCH 10/12] vinyl: add task accounting to global scheduler statistics Vladimir Davydov 2019-01-15 14:17 ` [PATCH 11/12] vinyl: add dump/compaction time to statistics Vladimir Davydov 2019-01-15 14:17 ` [PATCH 12/12] vinyl: add last level size " Vladimir Davydov 2019-01-17 11:35 ` [tarantool-patches] " Konstantin Osipov 2019-01-17 11:32 ` [tarantool-patches] Re: [PATCH 00/12] vinyl: statistics improvements Konstantin Osipov 2019-01-17 12:06 ` Vladimir Davydov 2019-01-20 21:16 ` Vladimir Davydov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=a3efe3513cd0bdfb4176cd746689fcecbc98eca8.1547558871.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH 04/12] vinyl: rename compact to compaction' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox