sql/backfill: prevent index backfill from evaluating new volatile key columns #81521
Labels
A-schema-changer-impl
Related to the implementation of the new schema changer
C-cleanup
Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Is your feature request related to a problem? Please describe.
Follow-up from #81486. The index backfiller can happily evaluate default expressions for new columns which will be part of a new primary index. This is critical to enable #47989. However, if the expressions being evaluated are volatile and are part of the key, then restarts will no longer be idempotent and will cause a corrupt index.
Describe the solution you'd like
We should return an assertion failure error if we ever try to execute such an index backfill. We should know the properties of the expressions at backfill time, so it's not hard to add.
Additional context
Relates both to #81449 and #81448.
When we want to support the following, we'll need to be smarter in how we plan. Namely, we need to first add the column to a primary index but not as a key column, take that all the way to at least validated, then go and build the index with the now materialized
k
being read from the new source.Jira issue: CRDB-15105
The text was updated successfully, but these errors were encountered: