Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
35912: roachtest: begin the release qualification roachtest whitelist r=nvanbenschoten a=danhhz

Starting with `tpcc/nodes=3/w=max` for now so I can get the teamcity
plumbing done. This test verifies that running our claimed max TPCC
warehouses works. The max depends on the hardware configuration:
currently 1450 on a 3-node GCE n1-standard-1 cluster or 2200 on a 3-node
AWS c5d.4xlarge cluster.

Release note: None

35915: sql: do not create stats on inverted index columns r=rytaft a=rytaft

This commit fixes an issue in which the default columns for
`CREATE STATISTICS` included inverted index columns. Since we
cannot create statistics on JSON columns, running automatic
statistics on a table with an inverted index resulted in the
error "unable to encode table key: *tree.DJSON". This commit
fixes the issue by skipping over inverted indexes when
determining the default columns for `CREATE STATISTICS`.

Fixes #35764

Release note (bug fix): Fixed an error that occurred when
creating statistics on tables with an inverted index.

35944: distsqlpb,importccl: fix a regression in IMPORT r=RaduBerinde a=knz

Fixes #35943.

This patch ensures that the full error message (pre-unwrap) is
included for errors that flow out of distsql process towards the
gateway.

This is important because some other internal mechanisms inside
CockroachDB are expecting to see the prefixes introduced by
errors.Wrap to decide other things (a bad idea, but not fixable in the
short term), for example see issue #35942.

Release note: None

Co-authored-by: Daniel Harrison <[email protected]>
Co-authored-by: Rebecca Taft <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
4 people committed Mar 19, 2019
4 parents 86df951 + d6dee2f + 22d1f80 + 475cb15 commit 40eee2e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func registerTPCC(r *registry) {
// match our expectation for the max tpcc warehouses that previous
// releases will support on this hardware.
MinVersion: maxVersion("v2.1.0", maybeMinVersionForFixturesImport(cloud)),
Tags: []string{`default`, `release_qualification`},
Cluster: makeClusterSpec(4, cpu(16)),
Run: func(ctx context.Context, t *test, c *cluster) {
var warehouses int
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/create_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ func createStatsDefaultColumns(

// Add columns for each secondary index.
for i := range desc.Indexes {
if desc.Indexes[i].Type == sqlbase.IndexDescriptor_INVERTED {
// We don't yet support stats on inverted indexes.
continue
}
idxCol := desc.Indexes[i].ColumnIDs[0]
if !requestedCols.Contains(int(idxCol)) {
columns = append(
Expand Down
3 changes: 2 additions & 1 deletion pkg/sql/distsqlpb/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func NewError(err error) *Error {
// Unwrap the error, to attain the cause.
// Otherwise, Wrap() may hide the roachpb error
// from the cast attempt below.
origErr := err
err = errors.Cause(err)

if pgErr, ok := pgerror.GetPGCause(err); ok {
Expand All @@ -155,7 +156,7 @@ func NewError(err error) *Error {
return &Error{
Detail: &Error_PGError{
PGError: pgerror.NewAssertionErrorf(
"uncaught error: %+v", err)}}
"uncaught error: %+v", origErr)}}
}
}

Expand Down
29 changes: 29 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/distsql_stats
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,35 @@ FROM [SHOW STATISTICS FOR TABLE groups] ORDER BY statistics_name, column_names::
statistics_name column_names
s {rowid}

# Regression test for #35764.
statement ok
CREATE TABLE users (
profile_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
last_updated TIMESTAMP DEFAULT now(),
user_profile JSONB,
INVERTED INDEX user_details (user_profile)
)

statement ok
INSERT INTO users (user_profile) VALUES
('{"first_name": "Lola", "last_name": "Dog", "location": "NYC", "online" : true, "friends" : 547}'),
('{"first_name": "Ernie", "status": "Looking for treats", "location" : "Brooklyn"}'),
('{"first_name": "Carl", "last_name": "Kimball", "location": "NYC", "breed": "Boston Terrier"}'
)

# Ensure that trying to create statistics with default columns does not fail
# when there is an inverted index.
statement ok
CREATE STATISTICS s FROM users

query TTI colnames
SELECT statistics_name, column_names, row_count
FROM [SHOW STATISTICS FOR TABLE users] ORDER BY statistics_name, column_names::STRING
----
statistics_name column_names row_count
s {last_updated} 3
s {profile_id} 3

# Arrays are supported.
statement ok
CREATE TABLE arr (x INT[])
Expand Down

0 comments on commit 40eee2e

Please sign in to comment.