From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH v2 5/8] vinyl: allow to commit statements to mem in arbitrary order Date: Sun, 27 May 2018 22:05:53 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: vy_mem_commit_stmt() expects statements to be committed in the order of increasing LSN. Although this condition holds now, it won't once we start using this function for building indexes. So let's remove this limitation. Needed for #1653 --- src/box/vy_mem.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/box/vy_mem.c b/src/box/vy_mem.c index faa2c06f..3954bf3a 100644 --- a/src/box/vy_mem.c +++ b/src/box/vy_mem.c @@ -245,11 +245,8 @@ vy_mem_commit_stmt(struct vy_mem *mem, const struct tuple *stmt) /* The statement must be from a lsregion. */ assert(!vy_stmt_is_refable(stmt)); int64_t lsn = vy_stmt_lsn(stmt); - if (mem->min_lsn == INT64_MAX) - mem->min_lsn = lsn; - assert(mem->min_lsn <= lsn); - if (mem->max_lsn < lsn) - mem->max_lsn = lsn; + mem->min_lsn = MIN(mem->min_lsn, lsn); + mem->max_lsn = MAX(mem->max_lsn, lsn); mem->version++; } -- 2.11.0