-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workload/schemachange: expect incomparable types #124887
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @DarrylWong, @rafiss, and @renatolabs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @annrpom, @DarrylWong, and @renatolabs)
pkg/workload/schemachange/operation_generator.go
line 3276 at r1 (raw file):
) AS cons ON cons.conrelid = cols.tableid WHERE table_name SIMILAR TO 'table_w[0-9]_+%' AND crdb_sql_type != 'REFCURSOR'
hm, well i think the idea with this function is that it occasionally will return an invalid parent column. so i believe we would want it to keep returning refcursor columns, even though they are invalid for foreign keys.
would it make sense to change rowsSatisfyFkConstraint
instead?
diff --git a/pkg/workload/schemachange/error_screening.go b/pkg/workload/schemachange/error_screening.go
index 786ac08e36c..169348e9571 100644
--- a/pkg/workload/schemachange/error_screening.go
+++ b/pkg/workload/schemachange/error_screening.go
@@ -1029,6 +1029,10 @@ SELECT count(*) FROM %s
numJoinRows, err := og.scanInt(ctx, tx, q)
if err != nil {
+ // UndefinedFunction errors mean that the column type is not comparable.
+ if pgErr := new(pgconn.PgError); errors.As(err, &pgErr) && pgcode.MakeCode(pgErr.Code) == pgcode.UndefinedFunction {
+ return false, nil
+ }
return false, err
}
return numJoinRows == childRows, err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @annrpom, @DarrylWong, and @renatolabs)
pkg/workload/schemachange/operation_generator.go
line 3276 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
hm, well i think the idea with this function is that it occasionally will return an invalid parent column. so i believe we would want it to keep returning refcursor columns, even though they are invalid for foreign keys.
would it make sense to change
rowsSatisfyFkConstraint
instead?diff --git a/pkg/workload/schemachange/error_screening.go b/pkg/workload/schemachange/error_screening.go index 786ac08e36c..169348e9571 100644 --- a/pkg/workload/schemachange/error_screening.go +++ b/pkg/workload/schemachange/error_screening.go @@ -1029,6 +1029,10 @@ SELECT count(*) FROM %s numJoinRows, err := og.scanInt(ctx, tx, q) if err != nil { + // UndefinedFunction errors mean that the column type is not comparable. + if pgErr := new(pgconn.PgError); errors.As(err, &pgErr) && pgcode.MakeCode(pgErr.Code) == pgcode.UndefinedFunction { + return false, nil + } return false, err } return numJoinRows == childRows, err
the other reason to avoid the check here is so that we don't need to maintain a list of non-comparable types here. refcursor may not always be the only one.
b3036eb
to
2b31ea9
Compare
that makes sense -- fixed |
This patch ensures that our schemachange workload will allow for invalid columns of incomparable types to pass the `rowsSatisfyFkConstraint` check -- as they are expected to fail later on with a foreign key violation. Epic: none Fixes: cockroachdb#124719 Release note: None
2b31ea9
to
0823fda
Compare
TFTR! ('-')7 bors r+ |
blathers backport 24.1 |
This patch ensures that our schemachange workload will
allow for invalid columns of incomparable types to pass the
rowsSatisfyFkConstraint
check -- as they are expected tofail later on with a foreign key violation.
Epic: none
Fixes: #124719
Release note: None