[Tarantool-patches] [PATCH v2] vinyl: restart read iterator in case of rolled back WAL
Aleksandr Lyapunov
alyapunov at tarantool.org
Tue Jun 16 15:10:38 MSK 2020
Thanks for the patch! See my 2 comments below:
On 6/1/20 7:46 PM, Nikita Pettik wrote:
>
> + if (vy_mem_tree_iterator_is_invalid(&src->mem_iterator.curr_pos)) {
> + assert(src->mem_iterator.curr.stmt == NULL);
> + return 1;
> + }
I'm afraid that the iterator will not always be invalid in the given case.
As I see, if a mem holds any older tuple with the same key (e.g. older
version of that tuple), the restoration routine will find the older tuple
with the non-invalid iterator.
I also think that mem_restore must handle all the possible data
changes by itself without concern of read_iterator.
> - if (vy_read_iterator_restore_mem(itr, &next) != 0)
> + int rc = vy_read_iterator_restore_mem(itr, &next);
> + if (rc < 0)
> return -1;
> + if (rc > 0) {
> + vy_read_iterator_restore(itr);
> + goto restart;
> + }
The read iterator was rewritten several times and still have at least
several bugs. I think we should admit that we cannot support such a
complicated solution. How about some stupid solution: if ANY change
has been happened during yield - restart advancing?
More information about the Tarantool-patches
mailing list