schemachanger: Fix concurrent DML failure when dropping a column with depended on by indexes/constraints #119254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a partial work to address a few concurrent DML failures with ongoing schema changes. The main theme of those failures involves dropping a column with dependent hash-sharded index, or expression index, or constraint, as reported in #111608, #111619, and #118314.
Our proposed solution is to introduce a new status for column element in the DSC so that the transition becomes
ABSENT <--> DELETE_ONLY <--> WRITE_ONLY <--> PUBLIC_BUT_INACCESSIBLE <--> PUBLIC
where the column stays in that newly introduced PUBLIC_BUT_INACCESSIBLE state until we hit NonRevertible phase where no thing could fail, at which time we can transition the column to non-public and eventually absent. It gives us two desirable effects with this approach:
1. the column is still public for the optimizer so that the current DML failure, which mostly revolves around a column is no longer public, can be solved;
2. the column is inaccessible for the user so it cannot be referenced in user queries, creating an effect of a dropped (or a dropping) column.