sql: set survive zone on regional by row system tables
Now that the region liveness work has been work we can finally enable it on multi-region clusters. To help aid in this this patch will do the following:
- All system tables will now be assigned a locality out of the gate, previously we were missing logic to set these settings on newly added system tables.
- Adding a region on the system database will configure the system database as SURVIVE REGION. Also the table: system.lease, system.sqlliveness, system.sqlinstances will be configured as survive zone.
- An upgrade will be added to migrate existing system database to SURVIVE REGION and the same version gate will be used to block setting SURVIVE REGION incorrectly. The tables will setup as system.lease, system.sqlliveness, system.sqlinstances will be migrated to SURVIVE ZONE.
- Previously, some system tables incorrectly did not have the inherit flags set on their zone configurations, these will be fixed during migration and during bootstrap.g
- The system.lease session based upgrade had a bug which caused it incorrectly be setup on multi-region configurations by not propagating partition information on the primary index.
Fixes: #119090 Epic: CC-24173
this is totally unrelated to your PR, but while we are adding one system database upgrade migration, do you think we could fix https://github.com/cockroachdb/cockroach/issues/113296 as well?
this is totally unrelated to your PR, but while we are adding one system database upgrade migration, do you think we could fix #113296 as well?
Yeah I'll sort that out here as well
@rafiss Reworked things a bit, since after chatting with Jeff we need to leave the system database as SURVIVE REGION, but only configure SURVIVE ZONE on the regional by row tables.
@JeffSwenson RFAL
bors r+
@rafiss @JeffSwenson TFTR!
bors r-
bors r+
We forgot to bump SystemDatabaseSchemaBootstrapVersion here.. Note that this was mentioned in TestSystemDatabaseSchemaBootstrapVersionBumped which was modified.