-
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
ddl, table: improve the efficiency of adding index #48184
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 #48184 +/- ##
================================================
+ Coverage 71.5384% 72.8006% +1.2621%
================================================
Files 1402 1425 +23
Lines 406159 413058 +6899
================================================
+ Hits 290560 300709 +10149
+ Misses 95775 93430 -2345
+ Partials 19824 18919 -905
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -470,23 +439,9 @@ func (w *Writer) flushKVs(ctx context.Context, fromClose bool) (err error) { | |||
}() | |||
|
|||
sortStart := time.Now() | |||
if w.shareMu != nil { | |||
sorty.MaxGor = min(8, uint64(variable.GetDDLReorgWorkerCounter())) |
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.
we don't need sorty
library? It has better performance
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 setting sorty.MaxGor
to 1
?
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.
/retest |
@tangenta: 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. |
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
// Valid returns true if the generator is exhausted. | ||
func (iter *IndexKVGenerator) Valid() bool { | ||
if len(iter.allIdxVals) == 0 { | ||
return iter.i == 0 |
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's only Valid()
before the first Next()
call?
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. For non multi-value indexes, there is only one index kv per row.
Co-authored-by: lance6716 <lance6716@gmail.com>
[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:
|
@tangenta: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: ref #47757
Problem Summary:
See #47757.
What is changed and how it works?
This PR contains multiple optimizations:
MergeSortOverlapThreshold
to 8000 to increase the threshold to trigger merge-sort step.extractDatumByOffsets
by decoding value into the datum directly instead of copying.GenIndexValue()
to avoid memory allocation.table.IndexIter
from interface to struct so that it is not escaping to heap anymore.GenIndexKey
to reduce overhead.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.