Skip to content
Snippets Groups Projects
Commit f2e30507 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Konstantin Osipov
Browse files

vinyl: allow to commit statements to mem in arbitrary order

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
parent 47105cd9
No related branches found
No related tags found
No related merge requests found
......@@ -245,11 +245,14 @@ 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;
/*
* Normally statement LSN grows monotonically,
* but not in case of building an index on an
* existing non-empty space. Hence use of MIN/MAX
* here.
*/
mem->min_lsn = MIN(mem->min_lsn, lsn);
mem->max_lsn = MAX(mem->max_lsn, lsn);
/*
* If we don't bump mem version after assigning LSN to
* a mem statement, a read iterator which uses
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment