Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
35077: workload: add indexes workload r=nvanbenschoten a=nvanbenschoten

Closes #34912.

This adds a new workload called `indexes`. Unlike `kv`, the workload is
specifically designed to stress secondary indexes. Its schema looks
like:

```
CREATE TABLE indexes (
    key     UUID  NOT NULL PRIMARY KEY,
    col0    INT   NOT NULL,
    col1    INT   NOT NULL,
    col2    INT   NOT NULL,
    col3    INT   NOT NULL,
    col4    INT   NOT NULL,
    col5    INT   NOT NULL,
    col6    INT   NOT NULL,
    col7    INT   NOT NULL,
    col8    INT   NOT NULL,
    col9    INT   NOT NULL,
    payload BYTES NOT NULL
)
```

and it includes knobs to specify how many of the "col" columns should be
indexed and whether they should be indexed using a UNIQUE specifier. The
workload also includes a knob to specify the size of the `payload`
column.

Release note: None

35116: sql: add support for extra session vars for pg compatibility r=knz a=knz

Fixes #35109.

This adds compatibility support for the following variables, with only
the default values that make sense in CockroachDB:

- `row_security`
- `synchronize_seqscans`,
- `lock_timeout`,
- `idle_in_transaction_session_timeout`

Release note: None

35134: storageccl: leave params in workload URIs r=dt a=dt

workload URIs do not contain anything sensitive and including them in the job make it easier see what it was actually doing.

Release note: none.

35151: sql: tolerate non-existent databases for plan cache invalidation r=knz a=knz

Fixes  #35145.

Release note (bug fix): CockroachDB again properly reports when a
database used during PREPARE does not exist any more when EXECUTE is
used.

35162: storage: remove TODOs in cmd_push_txn r=nvanbenschoten a=nvanbenschoten

This was discussed in #33523 (review) but I missed digging into it at the time. I still don't think I have my head fully wrapped around it, but I do enough to know that it's not something I want to start pulling on right now.

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
Co-authored-by: David Taylor <[email protected]>
  • Loading branch information
4 people committed Feb 25, 2019
6 parents 8617827 + 74e3029 + 532b684 + f62466c + f069ca9 + 35f0546 commit f9fde46
Show file tree
Hide file tree
Showing 14 changed files with 546 additions and 238 deletions.
3 changes: 3 additions & 0 deletions pkg/ccl/storageccl/export_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ func SanitizeExportStorageURI(path string) (string, error) {
if err != nil {
return "", err
}
if uri.Scheme == "experimental-workload" {
return path, nil
}
// All current export storage providers store credentials in the query string,
// if they store it in the URI at all.
uri.RawQuery = ""
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/workloadccl/allccl/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
_ "github.com/cockroachdb/cockroach/pkg/workload/bank"
_ "github.com/cockroachdb/cockroach/pkg/workload/bulkingest"
_ "github.com/cockroachdb/cockroach/pkg/workload/examples"
_ "github.com/cockroachdb/cockroach/pkg/workload/indexes"
_ "github.com/cockroachdb/cockroach/pkg/workload/interleavedpartitioned"
_ "github.com/cockroachdb/cockroach/pkg/workload/jsonload"
_ "github.com/cockroachdb/cockroach/pkg/workload/kv"
Expand Down
238 changes: 125 additions & 113 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/prepare
Original file line number Diff line number Diff line change
Expand Up @@ -962,3 +962,55 @@ query T
EXECUTE foobar(NULL, NULL)
----
NULL

subtest regression_35145

# Verify db-independent query behaves properly even when db does not exist

statement ok
SET application_name = ap35145

# Prepare in custom db

statement ok
CREATE DATABASE d35145; SET database = d35145;

statement ok
PREPARE display_appname AS SELECT setting FROM pg_settings WHERE name = 'application_name'

query T
EXECUTE display_appname
----
ap35145

# Check what happens when the db where the stmt was prepared disappears "underneath".

statement ok
DROP DATABASE d35145

query error database "d35145" does not exist
EXECUTE display_appname

statement ok
CREATE DATABASE d35145

query T
EXECUTE display_appname
----
ap35145

# Check what happens when the stmt is executed over a non-existent, unrelated db.

statement ok
CREATE DATABASE d35145_2; SET database = d35145_2; DROP DATABASE d35145_2

query error database "d35145_2" does not exist
EXECUTE display_appname

# Check what happens when the stmt is executed over no db whatsoever.

statement ok
SET database = ''

query error cannot access virtual schema in anonymous database
EXECUTE display_appname
12 changes: 12 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/set
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,15 @@ SET tracing.blah = 123

statement error invalid value for parameter "ssl_renegotiation_limit"
SET ssl_renegotiation_limit = 123

subtest regression_35109_flowable

statement ok
SET DATESTYLE = ISO;
SET INTERVALSTYLE = POSTGRES;
SET extra_float_digits TO 3;
SET synchronize_seqscans TO off;
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET row_security = off;
78 changes: 41 additions & 37 deletions pkg/sql/logictest/testdata/logic_test/show_source
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,47 @@ SELECT *
FROM [SHOW ALL]
WHERE variable != 'optimizer' AND variable != 'crdb_version'
----
variable value
application_name ·
bytea_output hex
client_encoding UTF8
client_min_messages notice
database test
datestyle ISO, MDY
default_int_size 8
default_transaction_isolation serializable
default_transaction_read_only off
distsql off
experimental_enable_zigzag_join off
experimental_force_split_at off
experimental_reorder_joins_limit 4
experimental_serial_normalization rowid
experimental_vectorize off
extra_float_digits 0
force_savepoint_restart off
integer_datetimes on
intervalstyle postgres
max_index_keys 32
node_id 1
results_buffer_size 16384
search_path public
server_encoding UTF8
server_version 9.5.0
server_version_num 90500
session_user root
sql_safe_updates off
standard_conforming_strings on
statement_timeout 0
timezone UTC
tracing off
transaction_isolation serializable
transaction_priority normal
transaction_read_only off
transaction_status NoTxn
variable value
application_name ·
bytea_output hex
client_encoding UTF8
client_min_messages notice
database test
datestyle ISO, MDY
default_int_size 8
default_transaction_isolation serializable
default_transaction_read_only off
distsql off
experimental_enable_zigzag_join off
experimental_force_split_at off
experimental_reorder_joins_limit 4
experimental_serial_normalization rowid
experimental_vectorize off
extra_float_digits 0
force_savepoint_restart off
idle_in_transaction_session_timeout 0
integer_datetimes on
intervalstyle postgres
lock_timeout 0
max_index_keys 32
node_id 1
results_buffer_size 16384
row_security off
search_path public
server_encoding UTF8
server_version 9.5.0
server_version_num 90500
session_user root
sql_safe_updates off
standard_conforming_strings on
statement_timeout 0
synchronize_seqscans on
timezone UTC
tracing off
transaction_isolation serializable
transaction_priority normal
transaction_read_only off
transaction_status NoTxn

query I colnames
SELECT * FROM [SHOW CLUSTER SETTING sql.defaults.distsql]
Expand Down
45 changes: 14 additions & 31 deletions pkg/sql/logictest/testdata/planner_test/explain
Original file line number Diff line number Diff line change
Expand Up @@ -140,34 +140,32 @@ split · ·
· row 0, expr 0 42

query TTT
EXPLAIN DROP TABLE foo
SELECT * FROM [EXPLAIN DROP TABLE foo] WHERE field != 'size'
----
drop table · ·

query TTT
EXPLAIN SHOW DATABASES
SELECT * FROM [EXPLAIN SHOW DATABASES] WHERE field != 'size'
----
distinct · ·
│ order key database_name
└── sort · ·
│ order +database_name
└── render · ·
└── values · ·
· size 4 columns, 20 rows

query TTT
EXPLAIN SHOW TABLES
SELECT * FROM [EXPLAIN SHOW TABLES] WHERE field != 'size'
----
sort · ·
│ order +table_schema,+table_name
└── render · ·
└── filter · ·
│ filter table_schema = 'public'
└── values · ·
· size 6 columns, 92 rows

query TTT
EXPLAIN SHOW TABLES WITH COMMENT
SELECT * FROM [EXPLAIN SHOW TABLES WITH COMMENT] WHERE field != 'size'
----
sort · ·
│ order +table_schema,+table_name
Expand All @@ -183,60 +181,53 @@ sort · ·
│ ├── filter · ·
│ │ │ filter table_schema = 'public'
│ │ └── values · ·
│ │ size 6 columns, 92 rows
│ └── values · ·
│ size 13 columns, 16 rows
└── scan · ·
· table comments@primary
· spans ALL

query TTT
EXPLAIN SHOW DATABASE
SELECT * FROM [EXPLAIN SHOW DATABASE] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter variable = 'database'
└── values · ·
· size 3 columns, 41 rows

query TTT
EXPLAIN SHOW TIME ZONE
SELECT * FROM [EXPLAIN SHOW TIME ZONE] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter variable = 'timezone'
└── values · ·
· size 3 columns, 41 rows

query TTT
EXPLAIN SHOW DEFAULT_TRANSACTION_ISOLATION
SELECT * FROM [EXPLAIN SHOW DEFAULT_TRANSACTION_ISOLATION] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter variable = 'default_transaction_isolation'
└── values · ·
· size 3 columns, 41 rows

query TTT
EXPLAIN SHOW TRANSACTION ISOLATION LEVEL
SELECT * FROM [EXPLAIN SHOW TRANSACTION ISOLATION LEVEL] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter variable = 'transaction_isolation'
└── values · ·
· size 3 columns, 41 rows

query TTT
EXPLAIN SHOW TRANSACTION PRIORITY
SELECT * FROM [EXPLAIN SHOW TRANSACTION PRIORITY] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter variable = 'transaction_priority'
└── values · ·
· size 3 columns, 41 rows

query TTT
EXPLAIN SHOW COLUMNS FROM foo
SELECT * FROM [EXPLAIN SHOW COLUMNS FROM foo] WHERE field != 'size'
----
sort · ·
│ order +ordinal_position
Expand All @@ -259,35 +250,31 @@ sort · ·
│ └── filter · ·
│ │ filter ((table_catalog = 'test') AND (table_schema = 'public')) AND (table_name = 'foo')
│ └── values · ·
│ size 23 columns, 962 rows
└── render · ·
└── filter · ·
│ filter ((table_catalog = 'test') AND (table_schema = 'public')) AND (table_name = 'foo')
└── values · ·
· size 13 columns, 3 rows

query TTT
EXPLAIN SHOW GRANTS ON foo
SELECT * FROM [EXPLAIN SHOW GRANTS ON foo] WHERE field != 'size'
----
sort · ·
│ order +database_name,+schema_name,+table_name,+grantee,+privilege_type
└── render · ·
└── filter · ·
│ filter (table_catalog, table_schema, table_name) IN (('test', 'public', 'foo'),)
└── values · ·
· size 8 columns, 600 rows

query TTT
EXPLAIN SHOW INDEX FROM foo
SELECT * FROM [EXPLAIN SHOW INDEX FROM foo] WHERE field != 'size'
----
render · ·
└── filter · ·
│ filter ((table_catalog = 'test') AND (table_schema = 'public')) AND (table_name = 'foo')
└── values · ·
· size 13 columns, 3 rows

query TTT
EXPLAIN SHOW CONSTRAINTS FROM foo
SELECT * FROM [EXPLAIN SHOW CONSTRAINTS FROM foo] WHERE field != 'size'
----
sort · ·
│ order +table_name,+constraint_name
Expand All @@ -298,15 +285,12 @@ sort · ·
├── filter · ·
│ │ filter relname = 'foo'
│ └── values · ·
│ size 27 columns, 94 rows
└── join · ·
│ type cross
├── filter · ·
│ │ filter nspname = 'public'
│ └── values · ·
│ size 4 columns, 4 rows
└── values · ·
· size 26 columns, 0 rows

query TTT
EXPLAIN SHOW USERS
Expand Down Expand Up @@ -334,14 +318,13 @@ CREATE TABLE t (
)

query TTT
EXPLAIN INSERT INTO t VALUES (1, 2)
SELECT * FROM [EXPLAIN INSERT INTO t VALUES (1, 2)] WHERE field != 'size'
----
count · ·
└── insert · ·
│ into t(k, v)
│ strategy inserter
└── values · ·
· size 2 columns, 1 row

query I
SELECT max(level) FROM [EXPLAIN (VERBOSE) INSERT INTO t VALUES (1, 2)]
Expand Down
Loading

0 comments on commit f9fde46

Please sign in to comment.