Skip to content

Commit

Permalink
kvserver: deflake TestBackpressureNotAppliedWhenReducingRangeSize
Browse files Browse the repository at this point in the history
This test relies on a second node's span config rangefeed to have caught
up sufficiently with the global state such that a snapshot, when
applied, would construct a replica with the config this test attempts to
declare over the originating replica. Though very unlikely to occur
(repro-ed only once in hours GCE worker runs), it's possible. This patch
is a speculative fix for a failure observed only with manual stressing
on a SHA that included #75233.

(Also make some prominent span config logging a bit more consistent with
one another.)

Release note: None
  • Loading branch information
irfansharif committed Jan 27, 2022
1 parent f918e4b commit d5175f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pkg/kv/kvserver/client_replica_backpressure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestBackpressureNotAppliedWhenReducingRangeSize(t *testing.T) {
tc.SplitRangeOrFatal(t, tablePrefix)
require.NoError(t, tc.WaitForSplitAndInitialization(tablePrefix))

for i := 0; i < dataSize/rowSize; i++ {
for i := 0; i < numRows; i++ {
tdb.Exec(t, "UPSERT INTO foo VALUES ($1, $2)",
rRand.Intn(numRows), randutil.RandBytes(rRand, rowSize))
}
Expand Down Expand Up @@ -268,6 +268,9 @@ func TestBackpressureNotAppliedWhenReducingRangeSize(t *testing.T) {
// Then we'll add a new server and move the table there.
moveTableToNewStore(t, tc, args, tablePrefix)

// Ensure that the new replica has applied the same config.
waitForSpanConfig(t, tc, tablePrefix, newMax)

s, repl := getFirstStoreReplica(t, tc.Server(1), tablePrefix)
s.SetReplicateQueueActive(false)
require.Len(t, repl.Desc().Replicas().Descriptors(), 1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (s *KVSubscriber) run(ctx context.Context) error {
fn()
}

log.Info(ctx, "established range feed over span configurations table")
log.Infof(ctx, "established range feed over system.span_configurations starting at time %s", initialScanTS)

injectedErrCh := s.knobs.KVSubscriberErrorInjectionCh

Expand Down
4 changes: 2 additions & 2 deletions pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (s *SQLWatcher) watchForDescriptorUpdates(
return nil, err
}

log.Infof(ctx, "established range feed over system.descriptors table starting at time %s", startTS)
log.Infof(ctx, "established range feed over system.descriptors starting at time %s", startTS)
return rf, nil
}

Expand Down Expand Up @@ -317,6 +317,6 @@ func (s *SQLWatcher) watchForZoneConfigUpdates(
return nil, err
}

log.Infof(ctx, "established range feed over system.zones table starting at time %s", startTS)
log.Infof(ctx, "established range feed over system.zones starting at time %s", startTS)
return rf, nil
}

0 comments on commit d5175f9

Please sign in to comment.