Skip to content

workload/schemachange: update sequence number initialization and getTableColumns error handling#58082

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
jayshrivastava:update-init-seq-number
Dec 21, 2020
Merged

workload/schemachange: update sequence number initialization and getTableColumns error handling#58082
craig[bot] merged 2 commits intocockroachdb:masterfrom
jayshrivastava:update-init-seq-number

Conversation

@jayshrivastava
Copy link
Copy Markdown
Contributor

@jayshrivastava jayshrivastava commented Dec 18, 2020

workload/schemachange: update sequence number initialization

Previously, it was possible for the seqNum of operationGeneratorParams
to be initialized to an incorrect value. When the workload would start,
it would check all table names, view names, and sequence names to
determine the starting value of the sequence number. This change
updates this behavior to ensure that enum names, index names,
schema names, and column names are checked as well. This ensures
that the sequence number starts at an appropriate value each
time the workload starts. This value is important for uniqueness
assumptions when generating names throughout the workload.

Previously, failing to check the names of enums, indexes, schemas,
and columns to initialize the global sequence number would cause
seg faults as outlined in the issue below.

Closes: #58076

Release note: None

workload/schemachange: return error when a table has no columns

Previously, unexpected syntax errors would occur if the workload
attempted to create an index on a table with no columns.
For example, the workload would generate a statements such as
CREATE INDEX index2 ON table1 (), which are syntactically
invalid. This change updates the function getTableColumns to
return an error if a table has no columns to use when creating
an index. The workload will try to generate another operation
when it sees this error.

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@jayshrivastava jayshrivastava marked this pull request as ready for review December 18, 2020 22:00
Previously, it was possible for the seqNum of operationGeneratorParams
to be initialized to an incorrect value. When the workload would start,
it would check all table names, view names, and sequence names to
determine the starting value of the sequence number. This change
updates this behavior to ensure that enum names, index names,
schema names, and column names are checked as well. This ensures
that the sequence number starts at an appropriate value each
time the workload starts. This value is important for uniqueness
assumptions when generating names throughout the workload.

Previously, failing to check the names of enums, indexes, schemas,
and columns to initialize the global sequence number would cause
seg faults as outlined in the issue below.

Closes: cockroachdb#58076

Release note: None
Previously, unexpected syntax errors would occur if the workload
attempted to create an index on a table with no columns.
For example, the workload would generate a statements such as
`CREATE INDEX index2 ON table1 ()`, which are syntactically
invalid. This change updates the function `getTableColumns` to
return an error if a table has no columns to use when creating
an index. The workload will try to generate another operation
when it sees this error.

Release note: None
@jayshrivastava jayshrivastava changed the title workload/schemachange: update sequence number initialization and error handling workload/schemachange: update sequence number initialization and getTableColumns error handling Dec 21, 2020
Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r3, 1 of 1 files at r4.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@jayshrivastava
Copy link
Copy Markdown
Contributor Author

bors r=ajwerner

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 21, 2020

Build succeeded:

@craig craig bot merged commit d4bc228 into cockroachdb:master Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roachtest: acceptance/version-upgrade fails due to panic in schema changer

3 participants