-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
schemadiff: analyze and apply ADD PARTITION and DROP PARTITION statements #10234
schemadiff: analyze and apply ADD PARTITION and DROP PARTITION statements #10234
Conversation
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
I've converted this PR to Draft. I want to explore an idea by @dbussink where a table diff might generate a sequence of diffs, not just a single one; such that we might diff two tables with multiple partition rotation changes, and generate a one-change-at-a-time sequence of alters. |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…ons/diffs. Implemented in range partitioning diffs Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…hemadiff-add-drop-partition-statements Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Ready to review: this PR now supports a diff that is a sequence of steps, in particular a sequence of |
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.
One small question here, but nothing blocking.
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Description
In this PR,
schemadiff
is able to:Generate multiple diffs for a table diff. A new function,
EntityDiff.SubsequentDiff()
returns the next-in-line diff for a given diff (ornil
) if these is none. Essentially, a diff is the head of a linked list. The helper functionAllSubsequent()
turns such a linked list into a slice.Utilize
RangeRotationStatements
inDiffHints
Diff two range-partition tables and analyze a sequence of
DROP PARTITION
andADD PARTITION
diffs. If partitions have rotated between the two tables (dropped "old" partitions from the 1st, added "new" partitions to the 2nd) thenDiff()
returns a sequence ofEntityDiffs
, approachable viaSubsequentDiff()
(see above), that can only be applied in-order to get into the new table format. These begin with the oldestDROP PARTITION
and end up with the newestADD PARTITION
.Apply()
now not only applies the givenEntityDiff
but also implicitly all subsequent diffs.RangeRotationStrategy
isRangeRotationFullSpec
(the default) we just get a singleAlterTableEntityDiff
which has the full partitioning specRangeRotationStrategy
isRangeRotationIgnore
, and if this is a range partition rotation, the partitioning change is silently ignored. If this is not a rotation, a full spec is generated.Related Issue(s)
Checklist