Skip to content
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

Support adding and satisfying a constraint in the same txn #4948

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

morgando
Copy link
Contributor

@morgando morgando commented Jan 6, 2025

No description provided.

Copy link

@roborivers roborivers left a 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: Error ⚠.
Regression testing: 305/598 tests failed ⚠.

The first 10 failing tests are:
odh_blobs [setup failure]
unionpar_maxqueue [setup failure]
sc_truncate_multiddl_generated [setup failure]
sc_inserts_logicalsc_generated [setup failure]
phys_rep_perf
online_compaction
timepart_trunc_serialsc_generated
timepart_trunc_multiddl_generated
timepart_trunc
constraints_partial_index_off_generated

@morgando morgando force-pushed the tran-foreign-keys branch 6 times, most recently from ed93701 to abd9c36 Compare January 7, 2025 18:10
Copy link

@roborivers roborivers left a 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: Error ⚠.
Regression testing: 193/597 tests failed ⚠.

The first 10 failing tests are:
sc_inserts_logicalsc_generated [setup failure]
sc_newuniq [setup failure]
writes_remsql_fdbpushredirect_generated [setup failure]
sorese_tran [setup failure]
sc_transactional_rowlocks_generated
phys_rep_perf
analyze_exit_immediately
timepart_trunc_serialsc_generated
timepart_trunc_multiddl_generated
timepart_trunc

@morgando morgando changed the title Support adding a constraint in a txn that gets satisfied in the same txn Support adding and satisfying a constraint in the same txn Jan 7, 2025
@morgando morgando force-pushed the tran-foreign-keys branch 8 times, most recently from 23fc18f to 2e1645e Compare January 9, 2025 21:23
Signed-off-by: Morgan Douglas <[email protected]>

Tweak replicant impl

Signed-off-by: Morgan Douglas <[email protected]>

Tweak repl impl

Signed-off-by: Morgan Douglas <[email protected]>

Tweak repl impl

Signed-off-by: Morgan Douglas <[email protected]>

Refactor master impl for supporting adding+satisfying constraint in the same txn

Signed-off-by: Morgan Douglas <[email protected]>

Refactor

Signed-off-by: Morgan Douglas <[email protected]>

Refactor

Signed-off-by: Morgan Douglas <[email protected]>

Refactor

Signed-off-by: Morgan Douglas <[email protected]>

Refactor

Signed-off-by: Morgan Douglas <[email protected]>

Refactor

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]>
Signed-off-by: Morgan Douglas <[email protected]>

Tweak test

Signed-off-by: Morgan Douglas <[email protected]>

Tweak test

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Teak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>

Tweak tests

Signed-off-by: Morgan Douglas <[email protected]>
in a txn
(1) constraint is added
(2) constraint is satisfied with an alter
during the scdone step for (2), replicants will
assume that, since there is a constraint pointing to
the table getting altered, the target key
must have existed in the table before it got altered.

This was previously a sound assumption because it was not possible
to first add a constraint before satisfying it in the same transaction,
which is the only case where this can validly occur.

The changes in this commit 'pass' the compatibility check if
we can't find the key that we're trying to validate in the
pre-alter dbtable.

TODO: make sure other compatibility checks in ondisk_schema_change aren't buggy.

Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
@@ -1042,6 +1061,7 @@ int finalize_alter_table(struct ireq *iq, struct schema_change_type *s,

free_db_and_replace(db, newdb);
fix_constraint_pointers(db, newdb);
try_to_populate_missing_reverse_constraints(NULL); // TODO: Don't suppress errors
Copy link
Contributor Author

@morgando morgando Jan 15, 2025

Choose a reason for hiding this comment

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

Is this necessary?

Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
Signed-off-by: Morgan Douglas <[email protected]>
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.

3 participants