Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH 05/12] vinyl: bump range version in vy_range.c
Date: Tue, 15 Jan 2019 17:17:14 +0300	[thread overview]
Message-ID: <c8fa604e0977839407865f1fa7be628c19d4e653.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>

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

  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 ` [PATCH 04/12] vinyl: rename compact to compaction Vladimir Davydov
2019-01-17 11:34   ` [tarantool-patches] " Konstantin Osipov
2019-01-17 12:08     ` Vladimir Davydov
2019-01-17 13:51       ` Konstantin Osipov
2019-01-15 14:17 ` Vladimir Davydov [this message]
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=c8fa604e0977839407865f1fa7be628c19d4e653.1547558871.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 05/12] vinyl: bump range version in vy_range.c' \
    /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