cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.91k stars 3.78k forks source link

kvserver: sep-raft-log: don't touch unreplicated RHS keyspace in split eval #97615

Open tbg opened 1 year ago

tbg commented 1 year ago

When evaluating a split command, we call WriteInitialReplicaState for the right-hand replica and send the result through raft. But we really only want the effects on the replicated keyspaces on the right hand side here. The unreplicated portions (raft state etc) should be written below-raft, on each store. This is a "nice cleanup" without separate raft log, but with the log separation it becomes more of a prerequisite, though we could work around it by "massaging" the batch below raft to remove the offending writes.

Epic: CRDB-220

Jira issue: CRDB-24789

blathers-crl[bot] commented 1 year ago

cc @cockroachdb/replication

tbg commented 1 year ago

I think we might be able to remove these writes, we already have the code downstream of raft that does the right thing:

https://github.com/cockroachdb/cockroach/blob/a9081374615abb6a06511bc35d29121fd14259af/pkg/kv/kvserver/store_split.go#L139-L153

This will affect production even when not separating the raft log though, so it should be done with a good amount of prudency.