When a Raft Group is deleted (via Clean command), a tombstone is written to log file, and added to MemTableAccessor. During rewrite, log file holding that tombstone is purged, but tombstone in memtable still can be retrieved and rewritten to Rewrite queue.
However, consider a Append file containing these operations [append1 (..), clean, append2 (..)]. During rewrite, the tombstone is actually rewritten in the wrong order [(..), append2 (..), clean]. This will cause the newly recreated Raft Group to disappear after restart.
TiKV guarantees to not recreate a region with the same ID, so this bug is of low severity.
Bug Report
Description
When a Raft Group is deleted (via
Clean
command), a tombstone is written to log file, and added toMemTableAccessor
. During rewrite, log file holding that tombstone is purged, but tombstone in memtable still can be retrieved and rewritten toRewrite
queue.However, consider a
Append
file containing these operations [append1 (..), clean, append2 (..)]. During rewrite, the tombstone is actually rewritten in the wrong order [(..), append2 (..), clean]. This will cause the newly recreated Raft Group to disappear after restart.TiKV guarantees to not recreate a region with the same ID, so this bug is of low severity.