Skip to content

Commit

Permalink
catalog/lease: deflake TestLeaseAtLatestVersion
Browse files Browse the repository at this point in the history
Currently, TestLeaseAtLatestVersion can flake when the initial version
of a descriptor is acquired, which this test is not designed to handle..
To address this, this patch disables the initial version acquisition to
deflake this test.

Fixes: #139386

Release note: None
  • Loading branch information
fqazi committed Jan 21, 2025
1 parent f8d3317 commit 9b293a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/sql/catalog/lease/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,10 @@ func TestLeaseAtLatestVersion(t *testing.T) {
srv, sqlDB, kvDB := serverutils.StartServer(t, params)
defer srv.Stopper().Stop(context.Background())
s := srv.ApplicationLayer()

// This test relies on the initial version not being acquired.
if _, err := sqlDB.Exec("SET CLUSTER SETTING sql.catalog.descriptor_wait_for_initial_version.enabled=false"); err != nil {
t.Fatal(err)
}
if _, err := sqlDB.Exec(`
BEGIN;
CREATE DATABASE t;
Expand All @@ -1168,7 +1171,6 @@ COMMIT;
`); err != nil {
t.Fatal(err)
}

tableDesc := desctestutils.TestingGetPublicTableDescriptor(kvDB, s.Codec(), "t", "kv")
var updated bool
if err := crdb.ExecuteTx(context.Background(), sqlDB, nil, func(tx *gosql.Tx) error {
Expand All @@ -1193,7 +1195,6 @@ INSERT INTO t.timestamp VALUES ('a', 'b');
}
updated = true
}

// This select will see version 1 of the table. It will first
// acquire a lease on version 2 and note that the table descriptor is
// invalid for the transaction, so it will read the previous version
Expand Down

0 comments on commit 9b293a5

Please sign in to comment.