Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
57491: workload/schemachange: complete error screening r=ajwerner a=jayshrivastava **workload/schemachange: complete error screening** This change adds error screening for the following ops: - createIndex - setColumnNotNull - dropConstraint - dropIndex - setColumnDefault - dropColumnStored - setColumnType - renameIndex Since all ops now have error screening, this change removes the overhead due to supporting ops that screen for errors and do not. Closes: #56119 Release note: None **workload/schemachange: refactor type resolution** Previously, the type resolver used to generate types.T structs from type name strings did not have logic for checking if schema names were present. This was causing enums to only exist in the public schema. Furthermore, the use of tree.ResolvableTypeReference in functions such as randType would make it difficult to inspect the type to see if a schema name were present. This change updates the type resolver to correctly handle type names which are prefixed with schemas. Furthermore, the type resolver will now fetch OIDs which can be used to check for type equivalence when screening for type-related errors. This change also refactors the operation generator to use a helper function for type resolution and the tree.TypeName struct to represent type names. Release note: None **workload/schemachange: cleanup error states on op generation failure** Previously, if an op func failed, then the op state would not get reset on subsequent iterations of the loop inside randOp. This meant that any expected execution errors or commit errors from the failed op generation would linger and potentially affect the next generated op. This change adds some simple mechanisms to ensure the expected errors get reset on op generation failure. Release note: None **workload/schemachange: allow validate after write** Transactions do not support schema changes after writes in the same transaction. Previously, a FeatureNotSupported error was anticipated when a validate operation followed an insertRow operation, but this error would never occur. This change removes that behavior because a validate should be allowed to occur after an insert in a transaction without expecting any errors. Release note: None **workload/schemachange: use regex to fetch tables** Previously, the clause `LIKE 'table%'` was used to fetch tables. This pattern was capabable of fetching system tables, such as information_schema.tables. Generally, this workload should not alter the system tables, and should only test using the tables it creates. Tables created by the workload can be fetched using the clause `~ 'table[0-9]+'`, which is the word 'table' followed by a sequence number. Release note: None **workload/schemachange: use nested transactions for op gen and err screening** Previously, it was possible for transactions to become aborted while generating operations or screening for errors. When a transaction became aborted and an operation generation function returned an error, a new operation generation function would be called with the same transaction. Because the transaction was aborted, all subsequent attempts to use it would fail, so this situation resulted in an infinite loop. This change updates the operation generator to use savepoints before each call to an operation generation function. If the operation generation function returns an error, the transaction is rolled back to the savepoint so the transaction can be reused. If there are any errors caused by using savepoints, the workload will terminate with a fatal error. Closes: #56120 Release note: None Co-authored-by: Jayant Shrivastava <jayants@cockroachlabs.com>
- Loading branch information