Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v2 5/8] vinyl: allow to commit statements to mem in arbitrary order
Date: Sun, 27 May 2018 22:05:53 +0300	[thread overview]
Message-ID: <c437bd9d2a935f26032b3ce4ca26ddf5d9660d9d.1527446023.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1527446023.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1527446023.git.vdavydov.dev@gmail.com>

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

  parent reply	other threads:[~2018-05-27 19:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 19:05 [PATCH v2 0/8] Allow to build indexes for vinyl spaces Vladimir Davydov
2018-05-27 19:05 ` [PATCH v2 1/8] vinyl: allocate key parts in vy_recovery_do_create_lsm Vladimir Davydov
2018-05-30 11:51   ` Konstantin Osipov
2018-05-27 19:05 ` [PATCH v2 2/8] vinyl: update recovery context with records written during recovery Vladimir Davydov
2018-05-30 11:51   ` Konstantin Osipov
2018-05-27 19:05 ` [PATCH v2 3/8] vinyl: log new index before WAL write on DDL Vladimir Davydov
2018-06-06 18:01   ` Konstantin Osipov
2018-05-27 19:05 ` [PATCH v2 4/8] vinyl: bump mem version after committing statement Vladimir Davydov
2018-06-07  5:41   ` Konstantin Osipov
2018-05-27 19:05 ` Vladimir Davydov [this message]
2018-06-07  5:41   ` [PATCH v2 5/8] vinyl: allow to commit statements to mem in arbitrary order Konstantin Osipov
2018-05-27 19:05 ` [PATCH v2 6/8] vinyl: relax limitation imposed on run min/max lsn Vladimir Davydov
2018-05-27 19:05 ` [PATCH v2 7/8] vinyl: factor out vy_check_is_unique_secondary Vladimir Davydov
2018-05-27 19:05 ` [PATCH v2 8/8] vinyl: allow to build secondary index for non-empty space 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=c437bd9d2a935f26032b3ce4ca26ddf5d9660d9d.1527446023.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 5/8] vinyl: allow to commit statements to mem in arbitrary order' \
    /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