From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH v2 4/8] vinyl: bump mem version after committing statement Date: Sun, 27 May 2018 22:05:52 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: Since commit 1e1c1fdbeddb ("vinyl: make read iterator always return newest tuple version") vinyl read iterator guarantees that any tuple it returns is the newest version in the iterator read view. However, if we don't bump mem version after assigning LSN to a mem statement, a read iterator using committed_read_view might not see it and return a stale tuple. Currently, there's no code that relies on this iterator feature, but we will need it for building new indexes. Without this patch, build (introduced later in the series) might return inconsistent results. Needed for #1653 --- src/box/vy_mem.c | 1 + test/unit/vy_mem.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/box/vy_mem.c b/src/box/vy_mem.c index 65e31ea5..faa2c06f 100644 --- a/src/box/vy_mem.c +++ b/src/box/vy_mem.c @@ -250,6 +250,7 @@ vy_mem_commit_stmt(struct vy_mem *mem, const struct tuple *stmt) assert(mem->min_lsn <= lsn); if (mem->max_lsn < lsn) mem->max_lsn = lsn; + mem->version++; } void diff --git a/test/unit/vy_mem.c b/test/unit/vy_mem.c index 6641dc0c..6666f94c 100644 --- a/test/unit/vy_mem.c +++ b/test/unit/vy_mem.c @@ -51,9 +51,9 @@ test_basic(void) /* Check version */ stmt = vy_mem_insert_template(mem, &stmts[4]); - is(mem->version, 6, "vy_mem->version") + is(mem->version, 8, "vy_mem->version") vy_mem_commit_stmt(mem, stmt); - is(mem->version, 6, "vy_mem->version") + is(mem->version, 9, "vy_mem->version") /* Clean up */ vy_mem_delete(mem); -- 2.11.0