Skip to content
Snippets Groups Projects
Commit 44b4d7ec authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Roman Tsisyk
Browse files

vinyl: fix crash in vy_read_iterator_restore_mem

vy_read_iterator_restore_mem() is called after a yield caused by a disk
read to restore the position of the iterator over the active in-memory
tree. It assumes that if a statement inserted into the active in-memory
tree during the yield is equal to the statement at which the read
iterator is positioned now (curr_stmt) by key but is older in terms of
LSN, then the iterator must be positioned at a txw statement. However,
the iterator could be positioned at an uncommitted statement stored in
the cache before the yield. We don't restore the cache iterator after a
yield, so if the new statement has been committed, its LSN will be less
than the LSN of the uncommitted statement stored in the cache although
it is indeed newer. This results in an assertion failure:

  vy_read_iterator.c:421: vy_read_iterator_restore_mem: Assertion `itr->curr_src == itr->txw_src' failed.

To fix this, let's modify the code checking if the iterator should be
repositioned to the active in-memory tree (mem_src) after a yield:
instead of comparing statement LSNs, let's reposition the iterator
unless it is currently positioned at a txw statement as it is the only
case when curr_stmt can be newer than the newly inserted statement.

Closes #2926
parent 4eeab69a
No related branches found
No related tags found
Loading
Loading
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