Skip to content

Commit 26f37dd

Browse files
committed
spanconfigreconcilerccl: deflake spanconfigreconcilerccl_test
Previously, the span config reconciller tests when running under a tenant did not use the transactional descriptor ID generator, which could lead to flake. Additionally, the transactional ID generator also was not being used for creating internal objects, when the testing knob is enabled. This patch fixes the multi-tenant tests to use the transactional ID generator and enables it for internal queries as well. Fixes: #154585 Release note: None
1 parent 588e5f6 commit 26f37dd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func (h *Handle) InitializeTenant(ctx context.Context, tenID roachpb.TenantID) *
7171
SpanConfig: h.scKnobs,
7272
GCJob: &tenantGCJobKnobs,
7373
UpgradeManager: serverUpgradeKnobs,
74+
SQLExecutor: &sql.ExecutorTestingKnobs{
75+
UseTransactionalDescIDGenerator: true,
76+
},
7477
},
7578
}
7679
var err error

pkg/sql/planner.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
2525
"github.com/cockroachdb/cockroach/pkg/sql/catalog/catsessiondata"
2626
"github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo"
27+
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descidgen"
2728
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
2829
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descs"
2930
"github.com/cockroachdb/cockroach/pkg/sql/catalog/lease"
@@ -462,6 +463,9 @@ func newInternalPlanner(
462463
p.extendedEvalCtx.NodeID = execCfg.NodeInfo.NodeID
463464
p.extendedEvalCtx.Locality = execCfg.Locality
464465
p.extendedEvalCtx.DescIDGenerator = execCfg.DescIDGenerator
466+
if execCfg.TestingKnobs.UseTransactionalDescIDGenerator && txn != nil {
467+
p.extendedEvalCtx.DescIDGenerator = descidgen.NewTransactionalGenerator(execCfg.Settings, execCfg.Codec, txn)
468+
}
465469

466470
p.sessionDataMutatorIterator = smi
467471

0 commit comments

Comments
 (0)