-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: support 2-phases flashback cluster #38164
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
0105f54
to
f9ea4db
Compare
Co-authored-by: bb7133 <[email protected]>
Done, PTAL @bb7133 |
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.
LGTM
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.
LGTM, two questions
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 06bdda7
|
ddl/cluster.go
Outdated
// Split region by keyRanges, make sure no unrelated key ranges be locked. | ||
splitRegionsByKeyRanges(d, keyRanges) | ||
totalRegions.Store(0) | ||
for _, ranges := range keyRanges { |
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.
for _, ranges := range keyRanges { | |
for _, range := range keyRanges { |
ddl/cluster.go
Outdated
endKey = rangeEndKey | ||
} | ||
|
||
logutil.BgLogger().Info("send prepare flashback request", zap.Uint64("region_id", loc.Region.GetID()), |
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.
logutil.BgLogger().Info("send prepare flashback request", zap.Uint64("region_id", loc.Region.GetID()), | |
logutil.BgLogger().Info("[ddl] send prepare flashback request", zap.Uint64("region_id", loc.Region.GetID()), |
ddl/cluster.go
Outdated
|
||
endKey := loc.EndKey | ||
isLast := len(endKey) == 0 || (len(rangeEndKey) > 0 && bytes.Compare(endKey, rangeEndKey) >= 0) | ||
// If it is the last region |
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.
// If it is the last region | |
// If it is the last region. |
ddl/cluster.go
Outdated
@@ -422,16 +565,25 @@ func (w *worker) onFlashbackCluster(d *ddlCtx, t *meta.Meta, job *model.Job) (ve | |||
job.SchemaState = model.StatePublic | |||
return ver, nil | |||
} | |||
|
|||
keyRanges, err := GetFlashbackKeyRanges(sess, tablecodec.EncodeTablePrefix(0)) | |||
keyRanges, err := GetFlashbackKeyRanges(sess) | |||
if err != nil { | |||
return ver, errors.Trace(err) | |||
} | |||
|
|||
for _, ranges := range keyRanges { |
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.
for _, ranges := range keyRanges { | |
for _, range := range keyRanges { |
ddl/cluster.go
Outdated
// use commitTS - 1 as startTS, make sure it less than commitTS. | ||
stats, err := sendFlashbackToVersionRPC(ctx, d.store.(tikv.Storage), flashbackTS, commitTS-1, commitTS, r) | ||
completedRegions.Add(uint64(stats.CompletedRegions)) | ||
logutil.BgLogger().Info("flashback cluster stats", |
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.
logutil.BgLogger().Info("flashback cluster stats", | |
logutil.BgLogger().Info("[ddl] flashback cluster stats", |
ddl/cluster.go
Outdated
if err = flashbackToVersion(context.Background(), d, flashbackTS, ranges.StartKey, ranges.EndKey); err != nil { | ||
if err = flashbackToVersion(d.ctx, d, | ||
func(ctx context.Context, r tikvstore.KeyRange) (rangetask.TaskStat, error) { | ||
// use commitTS - 1 as startTS, make sure it less than commitTS. |
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.
// use commitTS - 1 as startTS, make sure it less than commitTS. | |
// Use commitTS - 1 as startTS, make sure it less than commitTS. |
ddl/cluster.go
Outdated
|
||
return keyRanges, nil | ||
func prepareFlashbackToVersion( |
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.
It seems that this function code is the same as flashbackToVersion
. Is it duplicated?
/hold |
/unhold |
/unhold |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 45054eb
|
/run-build |
TiDB MergeCI notify✅ Well Done! New fixed [3] after this pr merged.
|
What problem does this PR solve?
Issue Number: close #38554, #37961
Problem Summary:
What is changed and how it works?
Above two reasons, we could remove many useless codes in Flashback. Like history flashback time ranges, auto analyze max time etc.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.