Skip to content

Conversation

@pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Oct 31, 2025

This PR introduces the ReplicaMark concept which encompasses both the RangeTombstone and RaftReplicaID. The two are strongly related, and there is an invariant describing which combinations are allowed.

The new ReplicaMark type strongly guards this invariant, and is used everywhere in code where previously RangeTombstone and RaftReplicaID were used in a loosely coupled manner.

This PR also documents an old bug in CreateUninitializedReplica, existence of which can be partially attributed to not strongly coupling RangeTombstone and RaftReplicaID before this PR. There should be fewer footguns now.

We will also use this type when replaying the WAG, to decide whether a WAG node has been applied. ReplicaMarks can be compared.

Related to #152845
Epic: CRDB-55220

@pav-kv pav-kv requested a review from arulajmani October 31, 2025 22:32
@pav-kv pav-kv requested a review from a team as a code owner October 31, 2025 22:32
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Epic: none
Release note: none
Epic: none
Release note: none
This commit make CreateUninitializedReplica and DestroyReplica use the
new ReplicaMark type with stronger assertions. It also documents the
existing bug in CreateUninitializedReplica, before we fix it.

Epic: none
Release note: none
Epic: none
Release note: none
Epic: none
Release note: none
Epic: none
Release note: none
There are no more users of these methods. Going forward, LoadReplicaMark
must be used instead.

Epic: none
Release note: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants