From 5e241b456d591c4f4b1e67a51d18f7594c51bb53 Mon Sep 17 00:00:00 2001 From: Pavel Kalinnikov Date: Mon, 6 Feb 2023 20:35:42 +0000 Subject: [PATCH] kvserver: rename the test-only replica loading func Release note: none Epic: none --- pkg/kv/kvserver/replica_init.go | 8 ++++---- pkg/kv/kvserver/split_queue_test.go | 2 +- pkg/kv/kvserver/store_pool_test.go | 2 +- pkg/kv/kvserver/store_test.go | 2 +- pkg/kv/kvserver/stores_test.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/kv/kvserver/replica_init.go b/pkg/kv/kvserver/replica_init.go index 2b355ad9ae17..f6bc6f2afa85 100644 --- a/pkg/kv/kvserver/replica_init.go +++ b/pkg/kv/kvserver/replica_init.go @@ -42,9 +42,9 @@ const ( mergeQueueThrottleDuration = 5 * time.Second ) -// loadInitializedReplica loads and constructs an initialized Replica, after -// checking its invariants. -func loadInitializedReplica( +// loadInitializedReplicaForTesting loads and constructs an initialized Replica, +// after checking its invariants. +func loadInitializedReplicaForTesting( ctx context.Context, store *Store, desc *roachpb.RangeDescriptor, replicaID roachpb.ReplicaID, ) (*Replica, error) { if !desc.IsInitialized() { @@ -180,7 +180,7 @@ func (r *Replica) setStartKeyLocked(startKey roachpb.RKey) { // loaded from storage. Must not be called more than once on a Replica. // // This method is called in: -// - loadInitializedReplica, to finalize creating an initialized replica; +// - loadInitializedReplicaForTesting, to finalize creating an initialized replica; // - splitPostApply, to initialize a previously uninitialized replica. func (r *Replica) initRaftMuLockedReplicaMuLocked(s kvstorage.LoadedReplicaState) error { if err := s.Check(r.StoreID()); err != nil { diff --git a/pkg/kv/kvserver/split_queue_test.go b/pkg/kv/kvserver/split_queue_test.go index 53f9503dcdeb..9f3fe38cdf92 100644 --- a/pkg/kv/kvserver/split_queue_test.go +++ b/pkg/kv/kvserver/split_queue_test.go @@ -100,7 +100,7 @@ func TestSplitQueueShouldQueue(t *testing.T) { replicaID := cpy.Replicas().VoterDescriptors()[0].ReplicaID require.NoError(t, logstore.NewStateLoader(cpy.RangeID).SetRaftReplicaID(ctx, tc.store.engine, replicaID)) - repl, err := loadInitializedReplica(ctx, tc.store, &cpy, replicaID) + repl, err := loadInitializedReplicaForTesting(ctx, tc.store, &cpy, replicaID) if err != nil { t.Fatal(err) } diff --git a/pkg/kv/kvserver/store_pool_test.go b/pkg/kv/kvserver/store_pool_test.go index cef730713330..8a05320d9d54 100644 --- a/pkg/kv/kvserver/store_pool_test.go +++ b/pkg/kv/kvserver/store_pool_test.go @@ -223,7 +223,7 @@ func TestStorePoolUpdateLocalStoreBeforeGossip(t *testing.T) { const replicaID = 1 require.NoError(t, logstore.NewStateLoader(rg.RangeID).SetRaftReplicaID(ctx, store.engine, replicaID)) - replica, err := loadInitializedReplica(ctx, store, &rg, replicaID) + replica, err := loadInitializedReplicaForTesting(ctx, store, &rg, replicaID) if err != nil { t.Fatalf("make replica error : %+v", err) } diff --git a/pkg/kv/kvserver/store_test.go b/pkg/kv/kvserver/store_test.go index b072da8a5a9c..9cd597593ac4 100644 --- a/pkg/kv/kvserver/store_test.go +++ b/pkg/kv/kvserver/store_test.go @@ -546,7 +546,7 @@ func createReplica(s *Store, rangeID roachpb.RangeID, start, end roachpb.RKey) * ); err != nil { panic(err) } - r, err := loadInitializedReplica(ctx, s, desc, replicaID) + r, err := loadInitializedReplicaForTesting(ctx, s, desc, replicaID) if err != nil { panic(err) } diff --git a/pkg/kv/kvserver/stores_test.go b/pkg/kv/kvserver/stores_test.go index 6104c48f6d63..429b0fbc83cd 100644 --- a/pkg/kv/kvserver/stores_test.go +++ b/pkg/kv/kvserver/stores_test.go @@ -157,7 +157,7 @@ func TestStoresGetReplicaForRangeID(t *testing.T) { require.NoError(t, logstore.NewStateLoader(desc.RangeID).SetRaftReplicaID(ctx, store.engine, replicaID)) - replica, err := loadInitializedReplica(ctx, store, desc, replicaID) + replica, err := loadInitializedReplicaForTesting(ctx, store, desc, replicaID) if err != nil { t.Fatalf("unexpected error when creating replica: %+v", err) }