From d5175f91c5d8d0bc547924d4b9c73761e93a09c8 Mon Sep 17 00:00:00 2001 From: irfan sharif Date: Wed, 26 Jan 2022 22:19:07 -0500 Subject: [PATCH] kvserver: deflake TestBackpressureNotAppliedWhenReducingRangeSize 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 --- pkg/kv/kvserver/client_replica_backpressure_test.go | 5 ++++- pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go | 2 +- pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/kv/kvserver/client_replica_backpressure_test.go b/pkg/kv/kvserver/client_replica_backpressure_test.go index 40b8e001b242..9470577c25e9 100644 --- a/pkg/kv/kvserver/client_replica_backpressure_test.go +++ b/pkg/kv/kvserver/client_replica_backpressure_test.go @@ -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)) } @@ -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) diff --git a/pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go b/pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go index 63334b37970f..95d9e076cde8 100644 --- a/pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go +++ b/pkg/spanconfig/spanconfigkvsubscriber/kvsubscriber.go @@ -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 diff --git a/pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go b/pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go index 1e94c6530edb..4b2b6811ad42 100644 --- a/pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go +++ b/pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go @@ -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 } @@ -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 }