FileStorage: fix rare data corruption when using restore after multiple undos (#395)
* FileStorage: fix data corruption when using restore after multiple undos
The case of a history like this:
- T0 initialize an object in state 0
- T1 modifies object to state 1
- T2 modifies object to state 2
- T3 undo T2 and T1, bringing back to state 0
- T4 modified object to state 3
- T5 undo T4, bringing back object to state 0
was not correct after `restore`: the state is 1 instead of the expected 0.
This is because T3 contains two data records:
- an undo of T2, with a backpointer to the data of state 1
- an undo of T1, with a backpointer to the data of state 0
When restoring T5 (the undo of T4), the transaction is made of one data
record, with a backpointer that is copied from the backpointer from T3,
but this uses backpointer from the first record for this object, which
is incorrect, in such a case where there is more than one backpointer
for the same oid, we need to iterate in all data record to find the
oldest version.
Co-authored-by:
Kirill Smelkov <kirr@nexedi.com>
Showing
Please register or sign in to comment