Skip to content

Commit 5efe495

Browse files
committed
rangefeed: make TestUnrecoverableErrors work with multi-tenancy
This test wants to see errors because of strict GC enforcement policies. To do so, it creates a scratch range and tries to trigger an error there. Strict GC enforcement policies don't apply to the scratch range out of the box, so to sidestep this, the test would explicitly configure the scratch range's span config. This explicit configuration only worked for the system tenant previously; this patch extends it to secondary tenants. Closes #109472 Release note: None
1 parent cdd0b29 commit 5efe495

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/kv/kvclient/rangefeed/rangefeed_external_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,6 @@ func TestUnrecoverableErrors(t *testing.T) {
952952
// handle duplicated events.
953953
kvserver.RangefeedUseBufferedSender.Override(ctx, &settings.SV, rt.useBufferedSender)
954954
srv, sqlDB, kvDB := serverutils.StartServer(t, base.TestServerArgs{
955-
DefaultTestTenant: base.TestIsForStuffThatShouldWorkWithSecondaryTenantsButDoesntYet(109472),
956955
Knobs: base.TestingKnobs{
957956
SpanConfig: &spanconfig.TestingKnobs{
958957
ConfigureScratchRange: true,

pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func (s *SQLTranslator) maybeGeneratePseudoTableRecords(
661661
func (s *SQLTranslator) maybeGenerateScratchRangeRecord(
662662
ctx context.Context, ids descpb.IDs,
663663
) (spanconfig.Record, error) {
664-
if !s.knobs.ConfigureScratchRange || !s.codec.ForSystemTenant() {
664+
if !s.knobs.ConfigureScratchRange {
665665
return spanconfig.Record{}, nil // nothing to do
666666
}
667667

@@ -677,10 +677,12 @@ func (s *SQLTranslator) maybeGenerateScratchRangeRecord(
677677
return spanconfig.Record{}, err
678678
}
679679

680+
scratchKey := append(s.codec.TenantPrefix(), keys.ScratchRangeMin...)
681+
scratchKey = scratchKey[:len(scratchKey):len(scratchKey)]
680682
record, err := spanconfig.MakeRecord(
681683
spanconfig.MakeTargetFromSpan(roachpb.Span{
682-
Key: keys.ScratchRangeMin,
683-
EndKey: keys.ScratchRangeMax,
684+
Key: scratchKey,
685+
EndKey: scratchKey.PrefixEnd(),
684686
}), zone.AsSpanConfig())
685687
if err != nil {
686688
return spanconfig.Record{}, err

0 commit comments

Comments
 (0)