-
Notifications
You must be signed in to change notification settings - Fork 4k
Ttl expire after #159416
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
Draft
rafiss
wants to merge
8
commits into
cockroachdb:master
Choose a base branch
from
rafiss:ttl-expire-after
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Ttl expire after #159416
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allow the function to be used by the declarative schemachanger in a future commit. Release note: None
…a changer Previously, the declarative schema changer did not support the ttl_expiration_expression storage parameter, requiring a fallback to the legacy schema changer when users wanted to define custom TTL expressions. This commit adds support for ttl_expiration_expression by: 1. Adding a ValidateTTLExpirationExpression method to the builder state that validates the expression type-checks as TIMESTAMPTZ, is not volatile, and references valid columns. 2. Adding CreateRowLevelTTLSchedule as a new deferred mutation operation that creates the TTL scheduled job when adding TTL to a table that doesn't already have one. 3. Extending metadataUpdater with CreateRowLevelTTLSchedule that creates the scheduled job and updates the table descriptor with the schedule ID. 4. Adding a notice when TTL is enabled on tables with inbound foreign keys that have cascading delete actions, warning about performance implications. This is part of the ongoing effort to support all TTL storage parameters in the declarative schema changer. Release note: None Epic: None
This adds end to end tests that make sure rolling back TTL storage paramters works. This also adds scplan tests to make sure the correct mutations are performed. Release note: None
Release note: None
Release note: None
Refactor the function so it accepts lookup functions rather than a raw table descriptor. This will allow the schema changer to use it for validating columns that are added in the same operation. Release note: None
Previously, the declarative schema changer did not support setting
`ttl_expire_after` storage parameters, which meant tables with TTL
using duration expressions would fall back to the legacy schema changer.
This was a gap in TTL functionality for the declarative schema changer.
To address this, this patch adds support for `ttl_expire_after` by:
1. Adding helper functions to manage the `crdb_internal_expiration`
hidden column that TTL requires when using `ttl_expire_after`:
- `addTTLColumn`: Creates the column with proper default and on-update
expressions using `sanitizeColumnExpression` for type annotation
- `dropTTLColumn`: Removes the column when TTL is reset
- `updateTTLColumnExpressions`: Updates expressions when the interval
changes
2. Updating `applyTTLStorageParamsSet` to detect when `ttl_expire_after`
is being added, changed, or switched from `ttl_expiration_expression`,
and performing the appropriate column operations.
3. Updating `applyTTLStorageParamsReset` to drop the TTL column when
resetting `ttl` or `ttl_expire_after`.
4. Improving error messages in `ValidateTTLExpirationColumn` to show
both expected and actual expressions for easier debugging.
5. Marking legacy-schema-changer-specific concurrent schema change tests
with `onlyif config local-legacy-schema-changer` since the declarative
schema changer handles these cases differently.
Fixes: cockroachdb#122379
Release note: None
Release note: None
|
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Member
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.