Skip to content

Commit b9835d8

Browse files
craig[bot]tbg
andcommitted
Merge #153348
153348: kvserver: improve logging in TestPromoteNonVoterInAddVoter r=tbg a=tbg See #134383 (comment). Touches #153084. Epic: None Co-authored-by: Tobias Grieger <[email protected]>
2 parents c93eab1 + 51c044e commit b9835d8

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

pkg/kv/kvserver/replicate_queue_test.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,12 +2151,32 @@ func TestPromoteNonVoterInAddVoter(t *testing.T) {
21512151
scope := log.Scope(t)
21522152
defer scope.Close(t)
21532153

2154+
// Add some debugging helpful for #134383, where the zone config update that
2155+
// should lead to down-replication is simply "ignored" and it's unclear who
2156+
// is to blame.
2157+
// `store=2` unconditionally logs changed spanconfigs in
2158+
// `spanconfigstore/store.go` and `reconciler=3` logs incoming updates from
2159+
// the rangefeed on the zone configs table. You'll need to look at the
2160+
// complete logs (not just the default log) and search for "test setting ZONE
2161+
// survival configuration" to find the start of the interesting bit. In
2162+
// passing runs, this shows the AUTO SPAN RECONCILIATION job acting on a new
2163+
// SQL update, changing the span configs (which should register on all nodes),
2164+
// and subsequent replication changes. In failing runs, it will be interesting
2165+
// which prefix of events remains.
2166+
{
2167+
old := log.GetVModule()
2168+
changed := "store=2,reconciler=3"
2169+
if old != "" {
2170+
changed = old + "," + changed
2171+
}
2172+
require.NoError(t, log.SetVModule(changed))
2173+
defer func() { _ = log.SetVModule(old) }()
2174+
}
2175+
21542176
// This test is slow under stress/race and can time out when upreplicating /
21552177
// rebalancing to ensure all stores have the same range count initially, due
21562178
// to slow heartbeats.
2157-
skip.UnderStress(t)
2158-
skip.UnderDeadlock(t)
2159-
skip.UnderRace(t)
2179+
skip.UnderDuress(t)
21602180

21612181
defer testutils.StartExecTrace(t, scope.GetDirectory()).Finish(t)
21622182

pkg/spanconfig/spanconfigreconciler/reconciler.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package spanconfigreconciler
77

88
import (
99
"context"
10+
"runtime/trace"
1011
"time"
1112

1213
"github.com/cockroachdb/cockroach/pkg/keys"
@@ -139,6 +140,7 @@ func (r *Reconciler) Reconcile(
139140
session sqlliveness.Session,
140141
onCheckpoint func() error,
141142
) error {
143+
defer trace.StartRegion(ctx, "spanconfig.Reconciler.Reconcile").End()
142144
// TODO(irfansharif): Avoid the full reconciliation pass if the startTS
143145
// provided is visible to the rangefeed. Right now we're doing a full
144146
// reconciliation pass every time the reconciliation job kicks us off.
@@ -185,6 +187,9 @@ func (r *Reconciler) Reconcile(
185187
r.mu.lastCheckpoint = reconciledUpUntil
186188
r.mu.Unlock()
187189

190+
if log.V(3) {
191+
log.Dev.Infof(ctx, "reconciled up until %s", reconciledUpUntil)
192+
}
188193
return onCheckpoint()
189194
})
190195
}
@@ -502,6 +507,9 @@ func (r *incrementalReconciler) reconcile(
502507
if len(sqlUpdates) == 0 {
503508
return callback(checkpoint) // nothing to do; propagate the checkpoint
504509
}
510+
if log.V(3) {
511+
log.Dev.Infof(ctx, "processing %d SQL updates", len(sqlUpdates))
512+
}
505513

506514
// Process the SQLUpdates and identify all descriptor IDs that require
507515
// translation. If the SQLUpdates includes ProtectedTimestampUpdates then

0 commit comments

Comments
 (0)