You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
155847: keys: assert that schema is immutable r=arulajmani,iskettaneh a=pav-kv
This PR adds a test which ensures that storage schema in `doc.go` does not change. If it does, the test fails and forces the author to think harder about the implications of the change.
**Context / example of a concern**: in replica destruction code (`kvstorage.DestroyReplica` and variants), we should destroy, among other things, the “unreplicated” keys. With separated engines this is tricky because the raft and state machine keys are inconveniently interleaved. Instead of using various ranged deletions that cover the entire keyspace, we can manually clear each key (which we all know). But if we do so, there is a risk someone adds a new key to the unreplicated section and forgets to update the destruction code. This at best could lead to a small disk space leak, and at worst a more serious bug in replica lifecycle.
**Another example**: the unreplicated space does not have ranged Pebble keys. Some code relies on this, e.g. `applySnapshot` does not clear ranged keys when rewriting the replica state (as an optimization, because there are none). It will have to start doing so if ranged keys are ever added to the unreplicated span.
Related to #152845
Co-authored-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
0 commit comments