vinyl: fix read source restore after statement removal
Suppose, a source iterator was positioned at the minimal statement across all sources before yielding to read a disk source. Then it has front_id equal to the front_id of the read iterator, which indicates that the source iterator needs to be advanced on the next iteration. However, if the statement was removed during the yield, the iterator gets repositioned on the next statement by the restoration procedure (see vy_read_iterator_next_key()). In this case it isn't positioned on the minimal statement any more and hence must not be advanced on the next iteration, but its front_id remains the same, which means it will be advanced, possibly skipping a statement. The situation described above can happen only in case of the tuple cache, because other sources are append-only. Obviously, to avoid this kind of trouble, we must reset the front_id if a source iterator is restored to a statement that is greater than the minimal statement.
Loading
Please register or sign in to comment