-
Notifications
You must be signed in to change notification settings - Fork 358
Feat!: Categorize indirect MV changes as breaking for seamless version switching #5374
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
Changes from all commits
59302da
9d10d01
55918ae
2e1bb9f
08e492d
97f001e
6609057
3dc0657
b18945f
fb559d2
ea775fb
b1286df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,6 +680,14 @@ def _categorize_snapshot( | |
| if mode == AutoCategorizationMode.FULL: | ||
| snapshot.categorize_as(SnapshotChangeCategory.BREAKING, forward_only) | ||
| elif self._context_diff.indirectly_modified(snapshot.name): | ||
| if snapshot.is_materialized_view and not forward_only: | ||
| # We categorize changes as breaking to allow for instantaneous switches in a virtual layer. | ||
| # Otherwise, there might be a potentially long downtime during MVs recreation. | ||
| # In the case of forward-only changes this optimization is not applicable because we want to continue | ||
| # using the same (existing) table version. | ||
| snapshot.categorize_as(SnapshotChangeCategory.INDIRECT_BREAKING, forward_only) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this looks good, but there's still a question what should be the correct behavior when The
In both cases, it is the user's explicit intent to continue using the same (existing) table version. How should we handle these scenarios?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. I'm not sure, but maybe we should keep the old behavior in case of forward-only changes?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a check to preserve the original behavior for forward-only changes. |
||
| return | ||
|
|
||
| all_upstream_forward_only = set() | ||
| all_upstream_categories = set() | ||
| direct_parent_categories = set() | ||
|
|
||
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.
I'm curious to understand a bit more about this. What would cause this long downtime? Can you give an example?
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.
RisingWave doesn't support
create or replacenor transactional DDL (although it can alter MVA_1and swap it with another existing MVA_2). Previously, sqlmesh would drop and recreate the MV in case of indirect changes, making the data unavailable until the MV was rebuilt (and this can take a lot of time in case of larger MVs).Even if an engine supports
create or replaceof some sort, I think having side-by-side versions of an MV allows for instantaneous rollbacks in a virtual layer.