-
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
br/lightning: add kv writer for external backend #46042
Conversation
Hi @tangenta. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #46042 +/- ##
================================================
- Coverage 74.7681% 72.6818% -2.0863%
================================================
Files 1293 1300 +7
Lines 398341 400221 +1880
================================================
- Hits 297832 290888 -6944
- Misses 81150 90850 +9700
+ Partials 19359 18483 -876
Flags with carried forward coverage won't be shown. Click here to find out more.
|
if err != nil { | ||
logutil.BgLogger().Error("close data writer failed", zap.Error(err)) | ||
} | ||
err = statWriter.Close(w.ctx) |
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.
the two closing is not atomic. what if TiDB node crashes between them and how will we find the dirty files when scanning s3? Do we treat the creating of stat file as the commit point of writing files to s3?
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 we should add the validation check when TiDB reading from s3.
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.
Or maybe the framework will choose another filenamePrefix
for the writer, and only expose the successful filenamePrefix
s to following reader?
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
/ok-to-test |
// Close closes the writer. | ||
func (w *Writer) Close(ctx context.Context) (backend.ChunkFlushStatus, error) { | ||
if w.closed { | ||
return status(true), nil |
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.
What's the situation w.closed is 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.
Normally, it should be closed only once.
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.
So, if it's a bug that w.closed is true, we can print an error log.
require.NoError(t, err) | ||
keyCnt += p.keys | ||
} | ||
require.Equal(t, uint64(kvCnt), keyCnt) |
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.
How about adding the test for two or three flush() and checking the data and stat file names?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lance6716, wjhuang2016 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: ref #45719
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.