Open keith-turner opened 6 years ago
I thought of this while working on #538 and #541. If something like this were added it would be nice to also add user level tools like mentioned in #535 to help users figure things out if these stateful checks trigger.
Data is written to WALs in temporal order. Mutations are written to a WAL with per tablet sequence numbers. The sequence numbers do not change until a minor compaction occurs. The fact of a minor compaction is recorded in the WAL.
Below is an example of a WAL in the order it was written with the following explanation of the contents.
2<<
with id5
. Everything else the log will use the id5
r1
columnf1:q1
tov1
. This mutation has a seq of1
in the WAL.r1 f1:q2=v2
with a seq of1
2
3
r1 f1:q1=v3
with a seq of3
Given the example above it would be odd to see mutations in a WAL with sequence numbers
X
,X+2
, andX+4
without seeing corresponding compaction events between the mutations. So we could add two types of sanity checks to the recovery code :[min_compaction_finish-2, max_compaction_finish]
.The retry behavior when writing to WALs and its efect on seq numbers, if any, needs to be looked into.