-
Notifications
You must be signed in to change notification settings - Fork 25
Move Lifecycle protection to the end #3072
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jmsuzuki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! thanks for the tests
| // This handles both: | ||
| // 1. Strategies that convert updates to drop+create (blocks both Removed AND Added for protected tables) | ||
| // 2. Strategies that return Updated (filters out column removals for DeletionProtected tables) | ||
| let filtered_changes: Vec<OlapChange> = if respect_life_cycle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum this is a better place - but I think we should pull it out of the diff completely and have it applied in another phase of the infra map compiler.
@LucioFranco Woudl you have a suggestion? The issue here is we produce the plan for changes as the set of diff for the infrastructure. That Plan should be sanitized with lifecycle rules which enfore what kind of operations are allowed on a Table / Object.
Right now it is embeeded in the diff logic and it is prone for developper mistakes and doesn't get enforced no matter what. I am thinking it should wrap the internal planning methods which should become private to the inner module to make sure other modules don't call it without the filtering.
Another idea is triggered in which we could use a visitor pattern to prune the plan? or and build it maybe? But that could be another iteration on the refactor
Move lifecycle protection filtering to the end. Previously, clickhouse strategy could upgrade an Update to a DROP/CREATE after lifecycle filtering
Note
Lifecycle protection is enforced after table diff strategies run, blocking DROP/CREATE for protected tables and adding tests for these scenarios.
strategy.diff_table_update, not before.TableChange::Removedand corresponding orphanAddedwhen target table isDeletionProtectedorExternallyManaged.UpdatedonDeletionProtected, filter outColumnChange::Removedonly.after) lifecycle for decisions; only count/apply non-empty filtered changes.DropCreateStrategymock and comprehensive tests covering: blocking strategy-generated DROP/CREATE forDeletionProtectedandExternallyManaged, allowing forFullyManaged, lifecycle transition to protected, and disabling protection via flag.Written by Cursor Bugbot for commit c5e1f06. This will update automatically on new commits. Configure here.