@@ -13,7 +13,6 @@ import (
1313 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/logstore"
1414 "github.com/cockroachdb/cockroach/pkg/raft/raftpb"
1515 "github.com/cockroachdb/cockroach/pkg/roachpb"
16- "github.com/cockroachdb/cockroach/pkg/storage"
1716 "github.com/cockroachdb/errors"
1817)
1918
@@ -121,8 +120,8 @@ const CreateUninitReplicaTODO = 0
121120// because it has been deleted.
122121func CreateUninitializedReplica (
123122 ctx context.Context ,
124- reader storage. Reader ,
125- writer storage. Writer ,
123+ stateRW State ,
124+ raftRO RaftRO ,
126125 storeID roachpb.StoreID ,
127126 id roachpb.FullReplicaID ,
128127) error {
@@ -131,7 +130,7 @@ func CreateUninitializedReplica(
131130 // indicate that this replica has been removed.
132131 // TODO(pav-kv): should also check that there is no existing replica, i.e.
133132 // ReplicaID load should find nothing.
134- if ts , err := sl .LoadRangeTombstone (ctx , reader ); err != nil {
133+ if ts , err := sl .LoadRangeTombstone (ctx , stateRW . RO ); err != nil {
135134 return err
136135 } else if id .ReplicaID < ts .NextReplicaID {
137136 return & kvpb.RaftGroupDeletedError {}
@@ -144,12 +143,12 @@ func CreateUninitializedReplica(
144143 // non-existent. The only RangeID-specific key that can be present is the
145144 // RangeTombstone inspected above.
146145 _ = CreateUninitReplicaTODO
147- if err := sl .SetRaftReplicaID (ctx , writer , id .ReplicaID ); err != nil {
146+ if err := sl .SetRaftReplicaID (ctx , stateRW . WO , id .ReplicaID ); err != nil {
148147 return err
149148 }
150149
151150 // Make sure that storage invariants for this uninitialized replica hold.
152151 uninitDesc := roachpb.RangeDescriptor {RangeID : id .RangeID }
153- _ , err := LoadReplicaState (ctx , reader , reader , storeID , & uninitDesc , id .ReplicaID )
152+ _ , err := LoadReplicaState (ctx , stateRW . RO , raftRO , storeID , & uninitDesc , id .ReplicaID )
154153 return err
155154}
0 commit comments