-
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
Online DDL: better support for range partitioning #15698
Online DDL: better support for range partitioning #15698
Conversation
…(applies to same table) Signed-off-by: Shlomi Noach <[email protected]>
…s always 'true' Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
…ways be true Signed-off-by: Shlomi Noach <[email protected]>
…nts, to allow multi-table DROP PARTITION statements Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
…tements combine DROP PARTITION statements Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
…o, it does not mark any particular details about a partition rotation special operation, as we do not expect such an operation to be revertible Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15698 +/- ##
==========================================
+ Coverage 68.41% 68.45% +0.04%
==========================================
Files 1558 1559 +1
Lines 196353 196302 -51
==========================================
+ Hits 134337 134388 +51
+ Misses 62016 61914 -102 ☔ View full report in Codecov by Sentry. |
go/vt/schema/ddl_strategy.go
Outdated
@@ -209,7 +209,7 @@ func (setting *DDLStrategySetting) IsPreferInstantDDL() bool { | |||
|
|||
// IsFastRangeRotationFlag checks if strategy options include --fast-range-rotation | |||
func (setting *DDLStrategySetting) IsFastRangeRotationFlag() bool { | |||
return setting.hasFlag(fastRangeRotationFlag) | |||
return true |
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.
Do we want to clean up this function in a follow up PR?
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.
Function is now removed.
Signed-off-by: Shlomi Noach <[email protected]>
Ping for review 🙏 |
go/vt/schemadiff/analysis.go
Outdated
|
||
import "vitess.io/vitess/go/vt/sqlparser" | ||
|
||
// AlterTableRotatesRangePartition answers `true` when the given ALTER TABLE statemnts performas any sort |
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.
Obviously minor, but statemnts performas
-> statement performs
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.
fixed
if onlineDDL.StrategySetting().IsFastRangeRotationFlag() { | ||
op, err := analyzeDropRangePartition(alterTable, createTable) | ||
// | ||
// - nothing here thus far |
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.
Are we saying that there are no special plans which support reverts?
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.
At this point in time yes. If we happen to stumble on some special plan that is revertible -- that's great.
go/vt/schemadiff/analysis.go
Outdated
// Such would be: | ||
// - Dropping any partition(s) | ||
// - Adding a new partition (empty, at the end of the list) | ||
func AlterTableRotatesRangePartition(alterTable *sqlparser.AlterTable) (bool, error) { |
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.
As we discussed via Slack, I think that we should at least check that this is indeed a RANGE partition change (vs. e.g. LIST).
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.
done
…ount and validates the table has RANGE partitioning Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Description
Context: #15674. This PR improves Online DDL support for range partitioning as follows:
--fast-range-rotation
DDL strategy. The flag is still allowed, but always assumed to betrue
. As discussed in Tracking: Online DDL partitioning changes improved support #15674 , a range partition rotation statement should always execute directly, and not through Online DDL.schemadiff
takes ownership of range partitioning rotation analysis, instead ofonlineddl/analysis.go
.ALTER TABLE ... DROP PARTITION
supports multiple partition names.schemadiff
now generates a singleALTER TABLE
with all dropped partitions rather than splitting into multipleALTER TABLE
statements.--fast-range-rotation
and assuming a range partition rotation, Online DDL devised designated plans for"add-range-partition"
and for"drop-range-partition"
, decorated with metadata, and presented some logic for potential revertibility of some operations. After consideration, we remove this logic. We cannot achieve revertibility for the entire set of partition rotation scenarios, and we choose to not offer revertibility for any of them, just as we don't offer revertibility forinstant-ddl
.Related Issue(s)
#15674
Checklist
Deployment Notes