This PR fixes a bug in libsql-wal transaction isolation that was thankfully caught by some assertions left behind.
Basically, we used to check that the frames we read from the main segment would not violate the max_frame_no property, we would use the log offset combined with the start offset in the index. This all worked fine with the regular mode of operation where frames are inserted in order, with increment of 1 in the wal. Things started to break with the replica, because frames can be inserted out-of-order, and with random increments.
To fix that, we remove the start_frame_no from the index, and instead we record the max_offset in the transaction: that offset correspond the max frame_no in the current segment, iow, any frame before that offset is guaranteed to be less that max_frame_no for that transaction.
This PR fixes a bug in libsql-wal transaction isolation that was thankfully caught by some assertions left behind.
Basically, we used to check that the frames we read from the main segment would not violate the max_frame_no property, we would use the log offset combined with the start offset in the index. This all worked fine with the regular mode of operation where frames are inserted in order, with increment of 1 in the wal. Things started to break with the replica, because frames can be inserted out-of-order, and with random increments.
To fix that, we remove the start_frame_no from the index, and instead we record the max_offset in the transaction: that offset correspond the max frame_no in the current segment, iow, any frame before that offset is guaranteed to be less that max_frame_no for that transaction.