Skip to content

Commit

Permalink
Merge pull request #137128 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.3-137059

release-24.3: catalog/lease: deflake TestDescriptorRefreshOnRetry
  • Loading branch information
rafiss authored Dec 11, 2024
2 parents f68f5e2 + 46e2b3e commit 00b09c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/sql/catalog/lease/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ go_test(
"//pkg/sql/sqlliveness",
"//pkg/sql/sqlliveness/slbase",
"//pkg/sql/sqlliveness/slprovider",
"//pkg/sql/stats",
"//pkg/sql/types",
"//pkg/storage",
"//pkg/testutils",
Expand Down
13 changes: 8 additions & 5 deletions pkg/sql/catalog/lease/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sqlinstance/instancestorage"
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slbase"
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slprovider"
"github.com/cockroachdb/cockroach/pkg/sql/stats"
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
Expand Down Expand Up @@ -949,14 +950,16 @@ func TestDescriptorRefreshOnRetry(t *testing.T) {
},
},
}
params.Settings = cluster.MakeTestingClusterSettings()
// Disable the automatic stats collection, which could interfere with
// the lease acquisition counts in this test.
stats.AutomaticStatisticsClusterMode.Override(ctx, &params.Settings.SV, false)
// Set a long lease duration so that the periodic task to refresh leases does
// not run.
lease.LeaseDuration.Override(ctx, &params.Settings.SV, 24*time.Hour)
srv, sqlDB, kvDB := serverutils.StartServer(t, params)
defer srv.Stopper().Stop(context.Background())
s := srv.ApplicationLayer()
// Disable the automatic stats collection, which could interfere with
// the lease acquisition counts in this test.
if _, err := sqlDB.Exec("SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false"); err != nil {
t.Fatal(err)
}
if _, err := sqlDB.Exec(`
CREATE DATABASE t;
CREATE TABLE t.foo (v INT);
Expand Down

0 comments on commit 00b09c8

Please sign in to comment.