@@ -120,14 +120,18 @@ const CreateUninitReplicaTODO = 0
120120// Returns kvpb.RaftGroupDeletedError if this replica can not be created
121121// because it has been deleted.
122122func CreateUninitializedReplica (
123- ctx context.Context , eng storage.Engine , storeID roachpb.StoreID , id roachpb.FullReplicaID ,
123+ ctx context.Context ,
124+ reader storage.Reader ,
125+ writer storage.Writer ,
126+ storeID roachpb.StoreID ,
127+ id roachpb.FullReplicaID ,
124128) error {
125129 sl := stateloader .Make (id .RangeID )
126130 // Before creating the replica, see if there is a tombstone which would
127131 // indicate that this replica has been removed.
128132 // TODO(pav-kv): should also check that there is no existing replica, i.e.
129133 // ReplicaID load should find nothing.
130- if ts , err := sl .LoadRangeTombstone (ctx , eng ); err != nil {
134+ if ts , err := sl .LoadRangeTombstone (ctx , reader ); err != nil {
131135 return err
132136 } else if id .ReplicaID < ts .NextReplicaID {
133137 return & kvpb.RaftGroupDeletedError {}
@@ -140,12 +144,12 @@ func CreateUninitializedReplica(
140144 // non-existent. The only RangeID-specific key that can be present is the
141145 // RangeTombstone inspected above.
142146 _ = CreateUninitReplicaTODO
143- if err := sl .SetRaftReplicaID (ctx , eng , id .ReplicaID ); err != nil {
147+ if err := sl .SetRaftReplicaID (ctx , writer , id .ReplicaID ); err != nil {
144148 return err
145149 }
146150
147151 // Make sure that storage invariants for this uninitialized replica hold.
148152 uninitDesc := roachpb.RangeDescriptor {RangeID : id .RangeID }
149- _ , err := LoadReplicaState (ctx , eng , storeID , & uninitDesc , id .ReplicaID )
153+ _ , err := LoadReplicaState (ctx , reader , storeID , & uninitDesc , id .ReplicaID )
150154 return err
151155}
0 commit comments