-
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
importinto: use one writer for each kv group for all concurrent encoder #47185
Conversation
Hi @D3Hunter. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
Hi @D3Hunter. 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. |
/ok-to-test |
@D3Hunter: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/label ok-to-test |
@D3Hunter: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/remove-label needs-ok-to-test |
/test all |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #47185 +/- ##
================================================
- Coverage 72.9737% 72.6722% -0.3016%
================================================
Files 1340 1361 +21
Lines 399989 406308 +6319
================================================
+ Hits 291887 295273 +3386
- Misses 89206 92260 +3054
+ Partials 18896 18775 -121
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -488,6 +488,9 @@ func (w *Writer) createStorageWriter(ctx context.Context) ( | |||
|
|||
// EngineWriter implements backend.EngineWriter interface. | |||
type EngineWriter struct { | |||
// Only 1 writer is used for some kv group(data or some index), no matter | |||
// how many routines are encoding data, so need to sync write to it. | |||
sync.Mutex |
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.
Why here add new Mutex,Could we reuse,global sort mutex that wenjun introduced in #47131
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.
see comments, i think that's quite clear
global sort mutex that wenjun introduced in #47131
that's shared among all writers
/assign windtalker |
/assign @windtalker |
@@ -94,6 +95,10 @@ func newByteReader( | |||
|
|||
// switchReaderMode switches to concurrent reader. | |||
func (r *byteReader) switchReaderMode(useConcurrent bool) { | |||
failpoint.Inject("disableConcurrentReader", func() { | |||
// current impl only supports S3, but we need test using GCS | |||
useConcurrent = false |
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.
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
@@ -488,6 +488,9 @@ func (w *Writer) createStorageWriter(ctx context.Context) ( | |||
|
|||
// EngineWriter implements backend.EngineWriter interface. |
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 mention it's concurrent safe in comments
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.
writer = w.writerFactory(indexID) | ||
w.writers[indexID] = writer | ||
} | ||
writer := w.getWriter(indexID) | ||
if err = writer.WriteRow(ctx, item.Key, item.Val, nil); err != 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.
seems if one writer has entered WriteRow
, it will block other kvs
which also need to access this writer. We can improve it later.
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 you mean kvs
in this loop? or in other concurrency?
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.
other concurrent call of WriteRow. I expect the idle writer can still do something
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.
depends on whether it's same index, other concurrency can still use writers of other index
[LGTM Timeline notifier]Timeline:
|
/hold |
need wait #47170 merged |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, lance6716, windtalker 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 |
/retest |
/unhold |
…nt encoder (pingcap#47185)" This reverts commit 4e82952.
…nt encoder (pingcap#47185)" This reverts commit 4e82952.
What problem does this PR solve?
Issue Number: ref #46704
Problem Summary:
in current design of global sort, each kv group, such as data kv or kv of same index id, should uses 1 writer
importinto change to it too
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.