Skip to content

Commit 93f81d8

Browse files
committed
logictest: add new config local-leased-descriptors
Previously, we didn't have much coverage for testing leased descriptors with pg_catalog / crdb_internal functions. This patch adds a new config to enable this feature on a subset of pg_catalog / crdb_internal tests. Release note: None
1 parent 282a83e commit 93f81d8

File tree

16 files changed

+229
-5
lines changed

16 files changed

+229
-5
lines changed

pkg/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ ALL_TESTS = [
521521
"//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test",
522522
"//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test",
523523
"//pkg/sql/logictest/tests/fakedist:fakedist_test",
524+
"//pkg/sql/logictest/tests/local-leased-descriptors:local-leased-descriptors_test",
524525
"//pkg/sql/logictest/tests/local-legacy-schema-changer:local-legacy-schema-changer_test",
525526
"//pkg/sql/logictest/tests/local-mixed-25.2:local-mixed-25_2_test",
526527
"//pkg/sql/logictest/tests/local-mixed-25.3:local-mixed-25_3_test",
@@ -2091,6 +2092,7 @@ GO_TARGETS = [
20912092
"//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test",
20922093
"//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test",
20932094
"//pkg/sql/logictest/tests/fakedist:fakedist_test",
2095+
"//pkg/sql/logictest/tests/local-leased-descriptors:local-leased-descriptors_test",
20942096
"//pkg/sql/logictest/tests/local-legacy-schema-changer:local-legacy-schema-changer_test",
20952097
"//pkg/sql/logictest/tests/local-mixed-25.2:local-mixed-25_2_test",
20962098
"//pkg/sql/logictest/tests/local-mixed-25.3:local-mixed-25_3_test",

pkg/sql/logictest/logic.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,18 @@ func (t *logicTest) newCluster(
18251825
t.Fatal(err)
18261826
}
18271827
}
1828+
if cfg.EnableLeasedDescriptorSupport {
1829+
if _, err := conn.Exec(
1830+
"SET CLUSTER SETTING sql.catalog.allow_leased_descriptors.enabled = true",
1831+
); err != nil {
1832+
t.Fatal(err)
1833+
}
1834+
if _, err := conn.Exec(
1835+
"SET CLUSTER SETTING sql.catalog.descriptor_lease.use_locked_timestamps.enabled = true",
1836+
); err != nil {
1837+
t.Fatal(err)
1838+
}
1839+
}
18281840
// We disable the automatic stats collection in order to have
18291841
// deterministic tests.
18301842
//

pkg/sql/logictest/logictestbase/logictestbase.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ type TestClusterConfig struct {
9595
DisableSchemaLockedByDefault bool
9696
// PrepareQueries executes queries and statements with Prepare and Execute.
9797
PrepareQueries bool
98+
// EnableLeasedDescriptorSupport enables leased descriptors for pg_catalog /
99+
// crdb_internal and locked leasing behavior.
100+
EnableLeasedDescriptorSupport bool
98101
}
99102

100103
// TenantMode is the type of the UseSecondaryTenant field in TestClusterConfig.
@@ -546,6 +549,19 @@ var LogicTestConfigs = []TestClusterConfig{
546549
BootstrapVersion: clusterversion.V25_3,
547550
NumNodes: 3,
548551
},
552+
{
553+
Name: "local-leased-descriptors",
554+
NumNodes: 1,
555+
OverrideDistSQLMode: "off",
556+
// local is the configuration where we run all tests which have bad
557+
// interactions with the default test tenant.
558+
//
559+
// TODO(#76378): We should review this choice. Why can't we use "Random"
560+
// here? If there are specific tests that are incompatible, we can
561+
// flag them to run only in a separate config.
562+
UseSecondaryTenant: Never,
563+
EnableLeasedDescriptorSupport: true,
564+
},
549565
}
550566

551567
// ConfigIdx is an index in the above slice.

pkg/sql/logictest/testdata/logic_test/comment_on

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LogicTest: !local-prepared
1+
# LogicTest: default-configs !local-prepared local-leased-descriptors 3node-tenant
22

33
statement ok
44
CREATE DATABASE db

pkg/sql/logictest/testdata/logic_test/pg_catalog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LogicTest: local
1+
# LogicTest: local local-leased-descriptors
22

33
# Set the distsql_workmem to the default production value because of a problem
44
# with losing 'name' attribute when spilling to disk (#78547).

pkg/sql/logictest/testdata/logic_test/privileges_comments

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: default-configs 3node-tenant local-leased-descriptors
2+
13
subtest regression45707
24

35
user root

pkg/sql/logictest/testdata/logic_test/show_create

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: default-configs 3node-tenant local-leased-descriptors
2+
13
statement ok
24
SET experimental_enable_unique_without_index_constraints = true
35

pkg/sql/logictest/testdata/logic_test/show_create_all_routines

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: default-configs 3node-tenant local-leased-descriptors
2+
13
statement ok
24
CREATE DATABASE d
35

pkg/sql/logictest/testdata/logic_test/show_create_all_schemas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: default-configs 3node-tenant local-leased-descriptors
2+
13
statement ok
24
CREATE DATABASE d
35

pkg/sql/logictest/testdata/logic_test/show_create_all_tables

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: default-configs 3node-tenant local-leased-descriptors
2+
13
statement ok
24
CREATE DATABASE d
35

0 commit comments

Comments
 (0)