Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

lightning: fix the bug that calculate unfinished ranges may miss some range #1413

Merged
merged 7 commits into from
Aug 6, 2021

Conversation

glorv
Copy link
Collaborator

@glorv glorv commented Aug 4, 2021

What problem does this PR solve?

Fix the bug that lightning local backend may encounter data loss.

Close #1403

What is changed and how it works?

  • Avoid change the global ranges when calculate unfinished ranges
  • Allow writeAndIngestByRanges to fail fast to avoid waiting some much time when met unrecoverable failure.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    • Use old and new cold to run with a test dataset about 10GB with 50GB disk capacity for sort-kv-dir. Before data loss always occur, and disappeared after this change.
  • No code

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release note

  • Fix the bug that lightning local backend may met checksum mismatch error due to data loss.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 4, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • gozssky

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@glorv glorv requested review from sleepymole and Little-Wallace and removed request for ZipFast August 4, 2021 09:23
@sleepymole
Copy link
Contributor

rest LGTM

}

// copy the ranges because we may change its values
ranges := make([]Range, 0, len(rawRanges))
ranges = append(ranges, rawRanges...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe can use built-in copy function

@ti-chi-bot ti-chi-bot added size/M and removed size/S labels Aug 5, 2021
if bytes.Compare(fr.end, start) > 0 {
start = fr.end
}
if bytes.Compare(fr.end, end) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if bytes.Compare(fr.end, end) > 0 {
if bytes.Compare(fr.end, end) >= 0 {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no difference between > and >= in this context

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. For >=, we can exit the loop early when fr.end == end.

@ti-chi-bot ti-chi-bot added the status/LGT1 LGTM1 label Aug 6, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 LGTM2 and removed status/LGT1 LGTM1 labels Aug 6, 2021
@glorv
Copy link
Collaborator Author

glorv commented Aug 6, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: e68fc55

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1416.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tidb lightning encountered error "error="checksum mismatched remote vs local
7 participants