cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.84k stars 3.77k forks source link

ttl: use declarative schemachanger for ttl_expire_after backfill #122379

Open rafiss opened 4 months ago

rafiss commented 4 months ago

Is your feature request related to a problem? Please describe. Cancelling a schema change like this: ALTER TABLE events SET (ttl_expire_after = '3 months') requires rolling back a backfill, since this adds a new column. This is currently slow.

Describe the solution you'd like We should use the declarative schema changer for the process of adding a ttl_expire_after column. This will make it easier to rollback the change if it's cancelled.

Additional context https://github.com/cockroachlabs/support/issues/2907

Epic CRDB-31281

Jira issue: CRDB-37845

rafiss commented 1 month ago

Lowering to P-3 since we are emphasizing the usage of ttl_expiration_expression over ttl_expire_after since this change: https://github.com/cockroachdb/docs/pull/18721. See: https://www.cockroachlabs.com/docs/stable/row-level-ttl#using-ttl_expire_after