-
Notifications
You must be signed in to change notification settings - Fork 216
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
Refactor verify_constraints_exist #4967
base: main
Are you sure you want to change the base?
Conversation
5cb8992
to
cc513f0
Compare
for (ii = 0; ii < thedb->num_dbs; ii++) { | ||
from_db = get_newer_db(thedb->dbs[ii], new_db); | ||
n_errors += verify_constraints_exist( | ||
from_db, from_db == to_db ? NULL : to_db, new_db, s); |
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.
Because of this line, calling
verify_constraints_exist(/*from_db*/ NULL, /*to_db*/ to_db, /*new_db*/ new_db)
will generate this call under the hood:
verify_constraints_exist(/*from_db*/ to_db, /*to_db*/ NULL, /*new_db*/ new_db)
.
To make this behavior explicit, I replaced all calls to verify_constraints_exist
that have no value for from_db
but a value for to_db
with calls to verify_constraints_to_and_from_dbtable
.
cc513f0
to
644dafb
Compare
Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Refactor Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]> Tweak impl Signed-off-by: Morgan Douglas <[email protected]>
4e36970
to
3faa6b7
Compare
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.
Coding style check: Error. ⚠.
Smoke testing: Success ✓.
Cbuild submission: Success ✓.
Regression testing: 1/595 tests failed ⚠.
The first 10 failing tests are:
sc_inserts_deletes [setup failure]
Signed-off-by: Morgan Douglas <[email protected]>
*/ | ||
static int verify_constraint(constraint_t * const ct, | ||
struct dbtable *source_db, | ||
struct dbtable *target_db, |
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.
TODO: Give source_db
and target_db
variables clearer names--maybe ct_source_db
/ct_target_db
?
return n_errors; | ||
} | ||
|
||
int verify_constraints_to_and_from_dbtable(struct dbtable *new_db, int is_updated, struct schema_change_type *s) |
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.
TODO: Considering renaming all is_updated
variables to undergoing_rebuild
/is_rebuild
/is_rebuild_needed
return n_errors; | ||
} | ||
|
||
int verify_constraints_to_and_from_dbtable(struct dbtable *new_db, int is_updated, struct schema_change_type *s) |
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.
TODO: Rename new_db
parameter just db
|
||
|
||
/* | ||
* Verifies constraints that refer to `target_db`. |
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.
TODO: This is slightly inaccurate.
Every constraint in the database will be validated, but only constraint rules referring to target_db
will be validated.
Update comment to clarify
No description provided.