diff --git a/pkg/cmd/roachtest/tests/tpcc.go b/pkg/cmd/roachtest/tests/tpcc.go index 71d21e92b6ec..c224e3baaad4 100644 --- a/pkg/cmd/roachtest/tests/tpcc.go +++ b/pkg/cmd/roachtest/tests/tpcc.go @@ -961,6 +961,9 @@ type tpccBenchSpec struct { MinVersion string // Tags to pass to testRegistryImpl.Add. Tags []string + // EncryptionEnabled determines if the benchmark uses encrypted stores (i.e. + // Encryption-At-Rest / EAR). + EncryptionEnabled bool } // partitions returns the number of partitions specified to the load generator. @@ -1029,6 +1032,12 @@ func registerTPCCBenchSpec(r registry.Registry, b tpccBenchSpec) { panic("unexpected") } + encryptionSupport := registry.EncryptionAlwaysDisabled + if b.EncryptionEnabled { + encryptionSupport = registry.EncryptionAlwaysEnabled + nameParts = append(nameParts, "enc=true") + } + name := strings.Join(nameParts, "/") numNodes := b.Nodes + b.LoadConfig.numLoadNodes(b.Distribution) @@ -1040,13 +1049,11 @@ func registerTPCCBenchSpec(r registry.Registry, b tpccBenchSpec) { } r.Add(registry.TestSpec{ - Name: name, - Owner: owner, - Cluster: nodes, - Tags: b.Tags, - // NB: intentionally not enabling encryption-at-rest to produce - // consistent results. - EncryptionSupport: registry.EncryptionAlwaysDisabled, + Name: name, + Owner: owner, + Cluster: nodes, + Tags: b.Tags, + EncryptionSupport: encryptionSupport, Run: func(ctx context.Context, t test.Test, c cluster.Cluster) { runTPCCBench(ctx, t, c, b) }, @@ -1501,6 +1508,34 @@ func registerTPCCBench(r registry.Registry) { LoadWarehouses: 10000, EstimatedMax: 8000, }, + + // Encryption-At-Rest benchmarks. These are duplicates of variants above, + // using encrypted stores. + { + Nodes: 3, + CPUs: 4, + + LoadWarehouses: 1000, + EstimatedMax: 325, + EncryptionEnabled: true, + }, + { + Nodes: 3, + CPUs: 16, + + LoadWarehouses: 2000, + EstimatedMax: 1300, + EncryptionEnabled: true, + }, + { + Nodes: 12, + CPUs: 16, + + LoadWarehouses: 10000, + EstimatedMax: 6000, + LoadConfig: singlePartitionedLoadgen, + EncryptionEnabled: true, + }, } for _, b := range specs { diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_schemas b/pkg/sql/logictest/testdata/logic_test/show_create_all_schemas index 1580f3a2dd8c..d39b1bbc049b 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_schemas +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_schemas @@ -40,3 +40,15 @@ SHOW CREATE ALL SCHEMAS create_statement CREATE SCHEMA public; CREATE SCHEMA test2; + +# Make sure database names with hyphens work well. +statement ok +CREATE DATABASE "d-d"; +USE "d-d"; +SHOW CREATE ALL SCHEMAS; + +# Make sure database names with quotes work well. +statement ok +CREATE DATABASE "a""bc"; +USE "a""bc"; +SHOW CREATE ALL SCHEMAS; diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables index 67ef7a7c4a72..ba2bf55f8b1f 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables @@ -434,3 +434,17 @@ CREATE TABLE public.t ( FAMILY f2 (z), FAMILY f3 (h) ); + +# Make sure database names with hyphens work well. +statement ok +CREATE DATABASE "d-d"; +USE "d-d"; +CREATE TABLE t(); +SHOW CREATE ALL TABLES; + +# Make sure database names with quotes work well. +statement ok +CREATE DATABASE "a""bc"; +USE "a""bc"; +CREATE TABLE t(); +SHOW CREATE ALL SCHEMAS; diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin index 6aac274ec54e..60a9c3e1bd1c 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin @@ -427,3 +427,17 @@ CREATE TABLE t_85418_2(); CREATE TABLE dbs_85418(db STRING); INSERT INTO dbs_85418 VALUES ('db_85418_1'), ('db_85418_2'); SELECT crdb_internal.show_create_all_tables(db) FROM dbs_85418; + +# Make sure database names with hyphens work well. +statement ok +CREATE DATABASE "d-d"; +USE "d-d"; +CREATE TABLE t(); +SELECT crdb_internal.show_create_all_tables('d-d'); + +# Make sure database names with quotes work well. +statement ok +CREATE DATABASE "a""bc"; +USE "a""bc"; +CREATE TABLE t(); +SELECT crdb_internal.show_create_all_tables('a"bc'); diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_types b/pkg/sql/logictest/testdata/logic_test/show_create_all_types index 601d337870b9..21440dcf3b37 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_types +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_types @@ -50,3 +50,15 @@ SHOW CREATE ALL TYPES create_statement CREATE TYPE public.tableobj AS ENUM ('row', 'col'); CREATE TYPE s.status AS ENUM ('a', 'b', 'c'); + +# Make sure database names with hyphens work well. +statement ok +CREATE DATABASE "d-d"; +USE "d-d"; +SHOW CREATE ALL TYPES; + +# Make sure database names with quotes work well. +statement ok +CREATE DATABASE "a""bc"; +USE "a""bc"; +SHOW CREATE ALL TYPES; diff --git a/pkg/sql/sem/builtins/show_create_all_schemas_builtin.go b/pkg/sql/sem/builtins/show_create_all_schemas_builtin.go index 0c7a2fc6fe1a..314fe9783dcd 100644 --- a/pkg/sql/sem/builtins/show_create_all_schemas_builtin.go +++ b/pkg/sql/sem/builtins/show_create_all_schemas_builtin.go @@ -16,6 +16,7 @@ import ( "unsafe" "github.com/cockroachdb/cockroach/pkg/kv" + "github.com/cockroachdb/cockroach/pkg/sql/lexbase" "github.com/cockroachdb/cockroach/pkg/sql/sem/eval" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -32,7 +33,7 @@ func getSchemaIDs( SELECT descriptor_id FROM %s.crdb_internal.create_schema_statements WHERE database_name = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) it, err := evalPlanner.QueryIteratorEx( ctx, "crdb_internal.show_create_all_schemas", @@ -73,7 +74,7 @@ func getSchemaCreateStatement( create_statement FROM %s.crdb_internal.create_schema_statements WHERE descriptor_id = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) row, err := evalPlanner.QueryRowEx( ctx, "crdb_internal.show_create_all_schemas", diff --git a/pkg/sql/sem/builtins/show_create_all_tables_builtin.go b/pkg/sql/sem/builtins/show_create_all_tables_builtin.go index d7e467da0d82..f20e45516b7f 100644 --- a/pkg/sql/sem/builtins/show_create_all_tables_builtin.go +++ b/pkg/sql/sem/builtins/show_create_all_tables_builtin.go @@ -17,6 +17,7 @@ import ( "unsafe" "github.com/cockroachdb/cockroach/pkg/kv" + "github.com/cockroachdb/cockroach/pkg/sql/lexbase" "github.com/cockroachdb/cockroach/pkg/sql/memsize" "github.com/cockroachdb/cockroach/pkg/sql/sem/eval" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" @@ -70,7 +71,7 @@ func getTopologicallySortedTableIDs( SELECT dependson_id FROM %s.crdb_internal.backward_dependencies WHERE descriptor_id = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) it, err := evalPlanner.QueryIteratorEx( ctx, "crdb_internal.show_create_all_tables", @@ -159,7 +160,7 @@ func getTableIDs( WHERE database_name = $1 AND is_virtual = FALSE AND is_temporary = FALSE - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) it, err := evalPlanner.QueryIteratorEx( ctx, "crdb_internal.show_create_all_tables", @@ -248,7 +249,7 @@ func getCreateStatement( create_nofks FROM %s.crdb_internal.create_statements WHERE descriptor_id = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) row, err := evalPlanner.QueryRowEx( ctx, "crdb_internal.show_create_all_tables", @@ -278,7 +279,7 @@ func getAlterStatements( %s FROM %s.crdb_internal.create_statements WHERE descriptor_id = $1 - `, statementType, dbName) + `, statementType, lexbase.EscapeSQLIdent(dbName)) row, err := evalPlanner.QueryRowEx( ctx, "crdb_internal.show_create_all_tables", diff --git a/pkg/sql/sem/builtins/show_create_all_types_builtin.go b/pkg/sql/sem/builtins/show_create_all_types_builtin.go index d48961ca8a7b..1f39e2b27b19 100644 --- a/pkg/sql/sem/builtins/show_create_all_types_builtin.go +++ b/pkg/sql/sem/builtins/show_create_all_types_builtin.go @@ -16,6 +16,7 @@ import ( "unsafe" "github.com/cockroachdb/cockroach/pkg/kv" + "github.com/cockroachdb/cockroach/pkg/sql/lexbase" "github.com/cockroachdb/cockroach/pkg/sql/sem/eval" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -32,7 +33,7 @@ func getTypeIDs( SELECT descriptor_id FROM %s.crdb_internal.create_type_statements WHERE database_name = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) it, err := evalPlanner.QueryIteratorEx( ctx, "crdb_internal.show_create_all_types", @@ -73,7 +74,7 @@ func getTypeCreateStatement( create_statement FROM %s.crdb_internal.create_type_statements WHERE descriptor_id = $1 - `, dbName) + `, lexbase.EscapeSQLIdent(dbName)) row, err := evalPlanner.QueryRowEx( ctx, "crdb_internal.show_create_all_types",