Skip to content

Commit

Permalink
Merge #130351
Browse files Browse the repository at this point in the history
130351: workload/schemachanger: ignore unique violation errors for CREATE INDEX r=fqazi a=fqazi

Previously, the schema changer workload added logic to ignore potential unique violation errors during CREATE UNIQUE INDEX. This logic was for the statement phase, which is not when this error would be noticed, so it did not work correctly. To address this, this patch adds the logic to make unique violations error as  potential commit error for CREATE INDEX.

Fixes: #129366

Release note: None

Co-authored-by: Faizan Qazi <[email protected]>
  • Loading branch information
craig[bot] and fqazi committed Sep 9, 2024
2 parents 25be3b1 + fb7a8e8 commit d8233a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/workload/schemachange/operation_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ func (og *operationGenerator) createIndex(ctx context.Context, tx pgx.Tx) (*opSt
// When an index exists, but `IF NOT EXISTS` is used, then
// the index will not be created and the op will complete without errors.
if !(indexExists && def.IfNotExists) {
stmt.potentialExecErrors.addAll(codesWithConditions{
og.potentialCommitErrors.addAll(codesWithConditions{
// If there is data in the table such that a unique index cannot be created,
// a pgcode.UniqueViolation will occur and will be wrapped in a
// pgcode.TransactionCommittedWithSchemaChangeFailure. The schemachange worker
Expand Down

0 comments on commit d8233a9

Please sign in to comment.