-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
lightning: refine progress for compress files import #39219
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. |
6b04978
to
04f28bd
Compare
br/pkg/lightning/mydump/region.go
Outdated
@@ -302,7 +302,7 @@ func MakeSourceFileRegion( | |||
// set fileSize to INF to make sure compressed files can be read until EOF. Because we can't get the exact size of the compressed files. | |||
// TODO: update progress bar calculation for compressed files. | |||
if fi.FileMeta.Compression != CompressionNone { | |||
rowIDMax = fileSize * 100 / divisor // FIXME: this is not accurate. Need more tests and fix solution. | |||
rowIDMax = fileSize * 500 / divisor // FIXME: this is not accurate. Need more tests and fix solution. |
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.
Does 500
represent the compress ratio? Maybe leave a comment here to illustrate the number.
…into lightningProgress
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.
rest LGTM
outLoop: | ||
for !canDeliver { | ||
readDurStart := time.Now() | ||
err = cr.parser.ReadRow() | ||
columnNames := cr.parser.Columns() | ||
newOffset, rowID = cr.parser.Pos() | ||
if cr.chunk.FileMeta.Compression != mydump.CompressionNone { |
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 not compressed, the realOffset
is not assigned and 0 is used. Is this the expected behavior ?
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.
Yes. Not compressed file won't use realOffset
.
br/pkg/lightning/restore/restore.go
Outdated
@@ -2299,6 +2299,8 @@ type deliveredKVs struct { | |||
columns []string | |||
offset int64 | |||
rowID int64 | |||
|
|||
realOffset int64 |
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.
Maybe add some comment, indicating that realOffset
is only used in compressed file scenarios.
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.
addressed in 32071ed
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
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 32071ed
|
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
What problem does this PR solve?
Issue Number: ref #38514
Problem Summary:
What is changed and how it works?
Currently lightning's progress is not accurate for compress files import. This PR uses reader's posistion to calculate progress for compressed files.
Check List
Tests
check whether lightning progress is correct when importing compressed files.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.