From 5ca2c9b6bbc0650d91d9072c6216ed15da2bf0ff Mon Sep 17 00:00:00 2001 From: Faizan Qazi Date: Thu, 9 Oct 2025 18:17:29 +0000 Subject: [PATCH] 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 --- .../spanconfigtestutils/spanconfigtestcluster/cluster.go | 3 +++ pkg/sql/planner.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go b/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go index 48c9a4f47ec8..8e01fb70bfcc 100644 --- a/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go +++ b/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go @@ -71,6 +71,9 @@ func (h *Handle) InitializeTenant(ctx context.Context, tenID roachpb.TenantID) * SpanConfig: h.scKnobs, GCJob: &tenantGCJobKnobs, UpgradeManager: serverUpgradeKnobs, + SQLExecutor: &sql.ExecutorTestingKnobs{ + UseTransactionalDescIDGenerator: true, + }, }, } var err error diff --git a/pkg/sql/planner.go b/pkg/sql/planner.go index 78b083c0e39e..18b3359ffde6 100644 --- a/pkg/sql/planner.go +++ b/pkg/sql/planner.go @@ -24,6 +24,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catsessiondata" "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descidgen" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs" "github.com/cockroachdb/cockroach/pkg/sql/catalog/lease" @@ -458,6 +459,9 @@ func newInternalPlanner( p.extendedEvalCtx.Locality = execCfg.Locality p.extendedEvalCtx.OriginalLocality = execCfg.Locality p.extendedEvalCtx.DescIDGenerator = execCfg.DescIDGenerator + if execCfg.TestingKnobs.UseTransactionalDescIDGenerator && txn != nil { + p.extendedEvalCtx.DescIDGenerator = descidgen.NewTransactionalGenerator(execCfg.Settings, execCfg.Codec, txn) + } p.sessionDataMutatorIterator = smi