-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#20033] YSQL: DDL commands must wait for rollback/roll-forward opera…
…tions Summary: Currently DDL Atomicity operations are asynchronous. This means that if DDL Atomicity is enabled, even after a YSQL DDL operation finishes, some DocDB DDL operations pertaining to this transaction may still happen in the background. Although this poses no correctness issues, it may happen that sometimes new DDL on the same table from the same PG session may fail because DDL rollback/roll-forward for the previous transaction has not finished yet. Otherwise, it may happen that any immediately succeeding DML fails because of the concurrent DocDB DDL happening on the table (example: an ALTER TABLE operation from the asynchronous background task may increment the schema version, causing any DML to fail with SchemaVersionMismatch). This may cause confusion to the user. To fix this, after committing/aborting the DDL operation, YSQL must wait for any rollback/roll-forward operations to finish before returning control to the user. Upgrade Safety * This change adds a new RPC IsYsqlDdlVerificationDone. This is issued by the TServers to the YB-Master to find the status of the DDL transaction in a best effort manner * This expectation is that TServers are upgraded after the master. Therefore when the TS sends a request to the master, it should be able to recognize this mesage and respond back. Even in the case that this request fails for any reason, it does not matter as fetching the DDL rollback status is best-effort and does not affect correctness. The TServers simply log error and continue. If this request fails and the TS is unable to wait for rollback to continue, it is possible for any upcoming DDL or DML on the same table to immediately fail with "DDL verification in progress". This phase is very transitory and should no longer continue once the DDL verification is finished. **Upgrade/Rollback safety** All changes are guarded by flag `ysql_ddl_transaction_wait_for_ddl_verification` Jira: DB-8998 Test Plan: ./yb_build.sh --cxx-test pg_ddl_atomicity-test Jenkins run through https://phorge.dev.yugabyte.com/D30471 Additionally new stress test with error injection will be implemented in a follow up patch. Reviewers: hsunder, myang Reviewed By: hsunder, myang Subscribers: fizaa, yql, ybase Differential Revision: https://phorge.dev.yugabyte.com/D30467
- Loading branch information
Showing
31 changed files
with
1,512 additions
and
752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.