Skip to content

Commit

Permalink
Merge #37673 #37689
Browse files Browse the repository at this point in the history
37673: roachtest: skip kv/gracefuldraining r=nvanbenschoten a=tbg

I should've done this a long time ago, it's been flaky for five months
and failed approximately 120 times (i.e. most of the time).

See #33501 (comment)

Release note: None

37689: partitionccl: error instead of panic for an invalid partitioning r=justinj,jordanlewis a=danhhz

If a PARTITION BY LIST both didn't match the column names in the index
being partitioned and also tried to partition by more columns than were
in the index, we previously panic'd when constructing the error.

Closes #37682

Release note (bug fix): Fixed a panic when construting the error message
for an invalid partitioning.

Co-authored-by: Tobias Schottdorf <[email protected]>
Co-authored-by: Daniel Harrison <[email protected]>
  • Loading branch information
3 people committed May 21, 2019
3 parents 23a68e9 + d39726d + d81dfec commit a344e7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/ccl/logictestccl/testdata/logic_test/partitioning
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ CREATE TABLE t (a INT, b INT, c INT, PRIMARY KEY (a, b, c)) PARTITION BY LIST (a
)
)

# Regression test for #37682
statement error declared partition columns \(a, b\) do not match first 1 columns in index being partitioned \(rowid\)
CREATE TABLE t (a INT DEFAULT 12, b INT DEFAULT 34) PARTITION BY LIST (a, b) (
PARTITION p1 VALUES IN ((1,2)),
PARTITION default VALUES IN (DEFAULT)
)

statement error PARTITION p1: name must be unique \(used twice in index "primary"\)
CREATE TABLE t (a INT, b INT, c INT, PRIMARY KEY (a, b)) PARTITION BY LIST (a) (
PARTITION p1 VALUES IN (1),
Expand Down
4 changes: 3 additions & 1 deletion pkg/ccl/partitionccl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func createPartitioningImpl(
}
cols = append(cols, *col)
if string(partBy.Fields[i]) != col.Name {
n := colOffset + len(partBy.Fields)
// This used to print the first `colOffset + len(partBy.Fields)` fields
// but there might not be this many columns in the index. See #37682.
n := colOffset + i + 1
return partDesc, pgerror.Newf(pgerror.CodeSyntaxError,
"declared partition columns (%s) do not match first %d columns in index being partitioned (%s)",
partitioningString(), n, strings.Join(indexDesc.ColumnNames[:n], ", "))
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func registerKVQuiescenceDead(r *registry) {

func registerKVGracefulDraining(r *registry) {
r.Add(testSpec{
Skip: "https://github.com/cockroachdb/cockroach/issues/33501",
Name: "kv/gracefuldraining/nodes=3",
Cluster: makeClusterSpec(4),
Run: func(ctx context.Context, t *test, c *cluster) {
Expand Down

0 comments on commit a344e7b

Please sign in to comment.