Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spanconfigreconciler: use fixed timestamp when reading descriptors #140400

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/spanconfig/spanconfigreconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,16 @@ func (r *incrementalReconciler) reconcile(
) error {
var err error

// Using a fixed timestamp prevents this background job from contending
// with foreground schema change traffic. Schema changes modify system
// objects like system.descriptor, system.descriptor_id_seq, and
// system.span_count. The spanconfig reconciler needs to read these
// objects also. A fixed timestamp is a defensive measure to help
// avoid contention caused by this background job.
err = txn.KV().SetFixedTimestamp(ctx, checkpoint)
if err != nil {
return err
}
// TODO(irfansharif): Instead of these filter methods for missing
// tables and system targets that live on the Reconciler, we could
// move this to the SQLTranslator instead, now that the SQLTranslator
Expand Down
10 changes: 0 additions & 10 deletions pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1683,16 +1683,6 @@ func (t *logicTest) newCluster(
tenantID := serverutils.TestTenantID()
conn := t.cluster.SystemLayer(0).SQLConn(t.rootT)

// TODO(rafi): Remove this setting. We're adding it since the 3node-tenant
// config seem to be flaky with autcommit_before_ddl = true. Disable that
// setting for multitenant configs while the issue is being investigated.
if _, err := conn.Exec(
"ALTER TENANT [$1] SET CLUSTER SETTING sql.defaults.autocommit_before_ddl.enabled = false",
tenantID.ToUint64(),
); err != nil {
t.Fatal(err)
}

clusterSettings := toa.clusterSettings
if len(clusterSettings) > 0 {
// We reduce the closed timestamp duration on the host tenant so that the
Expand Down