diff --git a/pkg/kv/kvserver/replica.go b/pkg/kv/kvserver/replica.go index 55890415809a..411f39dec194 100644 --- a/pkg/kv/kvserver/replica.go +++ b/pkg/kv/kvserver/replica.go @@ -809,6 +809,11 @@ func (r *Replica) GetGCThreshold() hlc.Timestamp { // Version returns the replica version. func (r *Replica) Version() roachpb.Version { + if r.mu.state.Version == nil { + // TODO(irfansharif,tbg): This is a stop-gap for #58523. + return roachpb.Version{} + } + r.mu.RLock() defer r.mu.RUnlock() return *r.mu.state.Version diff --git a/pkg/kv/kvserver/store.go b/pkg/kv/kvserver/store.go index 8bc6755177ba..abed71933eec 100644 --- a/pkg/kv/kvserver/store.go +++ b/pkg/kv/kvserver/store.go @@ -2719,6 +2719,10 @@ func (s *Store) PurgeOutdatedReplicas(ctx context.Context, version roachpb.Versi qp := quotapool.NewIntPool("purge-outdated-replicas", 50) g := ctxgroup.WithContext(ctx) s.VisitReplicas(func(repl *Replica) (wantMore bool) { + if (repl.Version() == roachpb.Version{}) { + // TODO(irfansharif,tbg): This is a stop gap for #58523. + return true + } if !repl.Version().Less(version) { // Nothing to do here. return true