Skip to content

Commit 7e1fd22

Browse files
committed
kvstorage: document plan for CreateUninitializedReplica
Epic: none Release note: none
1 parent 1c79b45 commit 7e1fd22

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/kv/kvserver/kvstorage/replica_state.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ func (r LoadedReplicaState) check(storeID roachpb.StoreID) error {
101101
return nil
102102
}
103103

104+
// CreateUninitReplicaTODO is the plan for splitting CreateUninitializedReplica
105+
// into cross-engine writes.
106+
//
107+
// 1. Log storage write (durable):
108+
// 1.1. Write WAG node with the state machine mutation (2).
109+
// 2. State machine mutation:
110+
// 2.1. Write RaftReplicaID with the new ReplicaID/LogID.
111+
//
112+
// TODO(sep-raft-log): support the status quo in which only 2.1 is written.
113+
const CreateUninitReplicaTODO = 0
114+
104115
// CreateUninitializedReplica creates an uninitialized replica in storage.
105116
// Returns kvpb.RaftGroupDeletedError if this replica can not be created
106117
// because it has been deleted.
@@ -134,6 +145,7 @@ func CreateUninitializedReplica(
134145
// the Term and Vote values for that older replica in the context of
135146
// this newer replica is harmless since it just limits the votes for
136147
// this replica.
148+
_ = CreateUninitReplicaTODO
137149
if err := sl.SetRaftReplicaID(ctx, eng, replicaID); err != nil {
138150
return err
139151
}

pkg/kv/kvserver/store_create_replica.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func (s *Store) tryGetOrCreateReplica(
203203
// be accessed by someone holding a reference to, or currently creating a
204204
// Replica for this rangeID, and that's us.
205205

206+
_ = kvstorage.CreateUninitReplicaTODO
206207
if err := kvstorage.CreateUninitializedReplica(
207208
// TODO(sep-raft-log): needs both engines due to tombstone (which lives on
208209
// statemachine).

0 commit comments

Comments
 (0)