vinyl: simplify memory iterator restore
To avoid lookup in the memory tree, the memory iterator ->restore() callback tries to walk from the current iterator position to the first statement matching the restoration criteria. Such an optimization complicates the restoration procedure beyond comprehension and makes it extremely error prone. Ironically, all this complexity seems to be pointless, because a change in the memory tree means either a disk access, which is by orders of magnitudes more expensive than a memory lookup, or an insertion of a new statement into the tree, which has exactly the same complexity as a lookup. That said, let's rewrite the restoration procedure so that it always does a full lookup in case the version of the memory tree has changed. Also, remove handling of iterator restart and the corresponding test case as a ->restore() callback does not need to handle them any more.
Loading
Please register or sign in to comment