vinyl: restart read iterator in case L0 is changed
Data read in vinyl is known to yield in case of disc access. So it opens a window for modifications of in-memory level. Imagine following scenario: right before data selection tuple is inserted into space. It passes first stage of commit procedure, i.e. it is prepared to be committed but still is not yet reached WAL. Meanwhile iterator is starting to read the same key. At this moment prepared statement is already inserted to in-memory tree ergo visible to read iterator. So, read iterator fetches this statement and proceeds to disk scan. In turn, disk scan yields and in this moment WAL fails to write statement on disk. Next, two cases are possible: 1. WAL thread has enough time to complete rollback procedure. 2. WAL thread fails to finish rollback in this time gap. In the first case read iterator should skip statement: version of in-memory tree has diverged from iterator's one, so we fall back into iterator restoration procedure. Mem iterator might become invalid so the only choice is to restart whole 'advance' routine. Let's don't try to restore it and always restart iteration cycle if L0 level has changed during yield. In the second case nothing is changed to read iterator, so it simply returns prepared statement (and it is considered to be OK). Closes #3395
Showing
- src/box/vy_read_iterator.c 5 additions, 54 deletionssrc/box/vy_read_iterator.c
- test/vinyl/gh-3395-read-prepared-uncommitted.result 232 additions, 0 deletionstest/vinyl/gh-3395-read-prepared-uncommitted.result
- test/vinyl/gh-3395-read-prepared-uncommitted.test.lua 125 additions, 0 deletionstest/vinyl/gh-3395-read-prepared-uncommitted.test.lua
- test/vinyl/suite.ini 1 addition, 1 deletiontest/vinyl/suite.ini
Loading
Please register or sign in to comment