From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 05/12] vinyl: bump range version in vy_range.c Date: Tue, 15 Jan 2019 17:17:14 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org List-ID: Currently, we bump range->version in vy_scheduler.c. This looks like an encapsulation violation, and may easily result in an error (as we have to be cautious to inc range->version whenever we modify a range). That said, let's bump range version right in vy_range.c. --- src/box/vy_range.c | 3 +++ src/box/vy_scheduler.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/box/vy_range.c b/src/box/vy_range.c index f489c95d..f649aff7 100644 --- a/src/box/vy_range.c +++ b/src/box/vy_range.c @@ -241,6 +241,7 @@ vy_range_add_slice(struct vy_range *range, struct vy_slice *slice) rlist_add_entry(&range->slices, slice, in_range); range->slice_count++; vy_disk_stmt_counter_add(&range->count, &slice->count); + range->version++; } void @@ -250,6 +251,7 @@ vy_range_add_slice_before(struct vy_range *range, struct vy_slice *slice, rlist_add_tail(&next_slice->in_range, &slice->in_range); range->slice_count++; vy_disk_stmt_counter_add(&range->count, &slice->count); + range->version++; } void @@ -260,6 +262,7 @@ vy_range_remove_slice(struct vy_range *range, struct vy_slice *slice) rlist_del_entry(slice, in_range); range->slice_count--; vy_disk_stmt_counter_sub(&range->count, &slice->count); + range->version++; } /** diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index ba20ef53..63ac948f 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -1208,7 +1208,6 @@ vy_task_dump_complete(struct vy_task *task) if (!vy_range_is_scheduled(range)) vy_range_heap_update(&lsm->range_heap, &range->heap_node); - range->version++; } free(new_slices); @@ -1560,7 +1559,6 @@ vy_task_compaction_complete(struct vy_task *task) break; } range->n_compactions++; - range->version++; vy_range_update_compaction_priority(range, &lsm->opts); vy_lsm_acct_range(lsm, range); vy_lsm_acct_compaction(lsm, &compaction_input, &compaction_output); -- 2.11.0