From a0d3054197c9be670999a3d73f374dc8f972fe37 Mon Sep 17 00:00:00 2001 From: Peter Mattis Date: Tue, 29 Nov 2016 09:46:36 -0500 Subject: [PATCH] storage: add replica pointer tag Debugging aid for #11591. --- pkg/storage/replica.go | 2 ++ pkg/storage/store.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pkg/storage/replica.go b/pkg/storage/replica.go index 1ed877a91446..413a559c5195 100644 --- a/pkg/storage/replica.go +++ b/pkg/storage/replica.go @@ -572,6 +572,8 @@ func newReplica(rangeID roachpb.RangeID, store *Store) *Replica { r.rangeStr.store(0, &roachpb.RangeDescriptor{RangeID: rangeID}) // Add replica log tag - the value is rangeStr.String(). r.AmbientContext.AddLogTag("r", &r.rangeStr) + // Add replica pointer value. + r.AmbientContext.AddLogTagStr("@", fmt.Sprintf("%x", r)) raftMuLogger := syncutil.ThresholdLogger( r.AnnotateCtx(context.Background()), diff --git a/pkg/storage/store.go b/pkg/storage/store.go index 22a55fe37031..e2dd0574aa46 100644 --- a/pkg/storage/store.go +++ b/pkg/storage/store.go @@ -1988,6 +1988,8 @@ func (s *Store) RemoveReplica( func (s *Store) removeReplicaImpl( ctx context.Context, rep *Replica, origDesc roachpb.RangeDescriptor, destroyData bool, ) error { + log.Infof(ctx, "removing replica") + desc := rep.Desc() if repDesc, ok := desc.GetReplicaDescriptor(s.StoreID()); ok && repDesc.ReplicaID >= origDesc.NextReplicaID { return errors.Errorf("cannot remove replica %s; replica ID has changed (%s >= %s)",