Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttl: ttl_expire_after and ttl_expiration_expression should not be allowed to be set at the same time #109138

Closed
Xiang-Gu opened this issue Aug 21, 2023 · 2 comments · Fixed by #110252
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@Xiang-Gu
Copy link
Contributor

Xiang-Gu commented Aug 21, 2023

We support two ways to effect row-level ttl: ttl_expire_after and ttl_expiration_expression.

Today, we support both to be set at the same time on one table. Although there is nothing wrong per se (we can still define the expected behavior in this case) but it is confusing and bug prune. I think it's best that we disallow this case.

PS: a bug that currently exists as a result of allowing both to be set:
If we create a table with both parameter set, RESET (ttl_expire_after) will remove the whole TTL configuration but the expected behavior is to just remove ttl_expire_after because we'd still have ttl_expiration_expression to vest TTL on this table. I guess this bug existed bc previously, we only support ttl_expire_after and resetting it means remove/disable TTL on this table so it makes sense to remove TTL configuration altogether. Later, when we added support for ttl_expiration_expression, we forget to amend that behavior.

Jira issue: CRDB-30800

Epic CRDB-29110

@Xiang-Gu Xiang-Gu added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Aug 21, 2023
@blathers-crl blathers-crl bot added this to Triage in SQL Foundations Aug 21, 2023
@dikshant
Copy link

dikshant commented Aug 22, 2023

We should not allow both at the same time. If ttl_expire_after is set, and someone tries to set ttl_expiration_expression we should emit and error saying both cannot be set at the same time, please remove ttl_expire_after and vice versa.

@ecwall ecwall self-assigned this Sep 5, 2023
@ecwall
Copy link
Contributor

ecwall commented Sep 6, 2023

@dikshant these can both be set together to allow migrating back and forth.

I will fix RESET (ttl_expire_after) so that it does not reset all TTL configuration.

@ecwall ecwall added the db-cy-23 label Sep 6, 2023
craig bot pushed a commit that referenced this issue Sep 15, 2023
110252: ttl: do not remove all table TTL settings on RESET (ttl_expire_after) r=Xiang-Gu a=ecwall

Fixes #109138

Previously running `RESET (ttl_expire_after)` would remove all table TTL
settings if `ttl_expiration_expression` was set.

This PR fixes the schema changer to only remove all TTL settings on
`RESET (ttl)`.

Release note (bug fix): `RESET (ttl_expire_after)` no longer incorrectly
removes `ttl_expiration_expression`.

110649: changefeedccl: add version gate for lagging ranges options r=jayshrivastava a=jayshrivastava

Previously, there was no version gate for the `lagging_ranges_threshold` and `lagging_ranges_polling_interval` changefeed options. In a mixed version state, this makes it possible for a changefeed to be created on v23.2 and resumed in v23.1. Such a changefeed will fail because those options do not exist in 23.1.

This change adds a version gate to fix this problem.

Release note: None
Epic: None

Co-authored-by: Evan Wall <wall@cockroachlabs.com>
Co-authored-by: Jayant Shrivastava <jayants@cockroachlabs.com>
@craig craig bot closed this as completed in 09061e4 Sep 15, 2023
SQL Foundations automation moved this from Triage to Done Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
Development

Successfully merging a pull request may close this issue.

3 participants