-
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
lightning: support prepared statement and client stmt cache in logical import mode #55482
Conversation
set db properties in DBFromConfig increase minDeliverBytes to 10m add log to show session variable support prepared statement in tidb lightning mode fix bugs try to reduce the inuse memory try to avoid oom Update import.go change lru cache to kvcache add configuration LogicalImportPrepStmt add logical logicalImportPrepStmt config add initial test test single statement fix the bug in test
Hi @dbsid. 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 @dbsid. 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-sigs/prow repository. |
/ok-to-test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #55482 +/- ##
================================================
+ Coverage 73.4071% 73.6674% +0.2603%
================================================
Files 1600 1631 +31
Lines 443627 447086 +3459
================================================
+ Hits 325654 329357 +3703
+ Misses 98033 97618 -415
- Partials 19940 20111 +171
Flags with carried forward coverage won't be shown. Click here to find out more.
|
by: make bazel_prepare
/cc @D3Hunter @lance6716 |
please merge master to fix lightning CI @dbsid |
@@ -309,6 +334,11 @@ type tidbBackend struct { | |||
// affecting the cluster too much. | |||
maxChunkSize uint64 | |||
maxChunkRows int | |||
// implement stmtCache to improve performance, especially when the downstream is TiDB | |||
stmtCache *kvcache.SimpleLRUCache |
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.
as long as the table is importing, the prepared stmt is needed, no need such LRU
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 reason to use LRU here is that the batch insert prepared statement may not be the same. where the insert/replace statement is constrained by logical-import-batch-size
, the actual SQL executed might be longer or shorter, depending on the actual content imported.
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 row size is unstable for prepared stmt, in worse case, every prepared stmt is different. we can ignore batch-size in this case, and only honors batch-rows, cc @lance6716
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 default logical-import-batch-rows
is 65536, usually this batch size is too large, should we lower the default value of logical-import-batch-rows
to some reasonable number like 128/256/512?
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.
Not the author of #46607, but we've got customer which database is unable to handle 96 KB transactions thus requiring the limit to be lowered.
The -batch-size
does not need to be very precise. It is mainly used to ensure (number of rows) × (size of row) to be maintained at a constant limit. You should not ignore the batch-size entirely because the same limit is shared among all tables and the constraint should be reasonable for both wide and narrow tables.
Co-authored-by: D3Hunter <jujj603@gmail.com>
/hold need confirm from PM |
@@ -309,6 +334,11 @@ type tidbBackend struct { | |||
// affecting the cluster too much. | |||
maxChunkSize uint64 | |||
maxChunkRows int | |||
// implement stmtCache to improve performance, especially when the downstream is TiDB | |||
stmtCache *kvcache.SimpleLRUCache |
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 row size is unstable for prepared stmt, in worse case, every prepared stmt is different. we can ignore batch-size in this case, and only honors batch-rows, cc @lance6716
please prepare a doc pr to this feature |
|
/retest |
/retest |
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: D3Hunter, lance6716, qw4990, yudongusa 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 |
/unhold |
/test pull-integration-ddl-test |
/test unit-test |
@dbsid: The specified target(s) for
Use 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-sigs/prow repository. |
@dbsid: The specified target(s) for
Use 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-sigs/prow repository. |
/retest |
@dbsid: 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-sigs/prow repository. I understand the commands that are listed here. |
/retest |
1 similar comment
/retest |
…l import mode (pingcap#55482) close pingcap#54850
What problem does this PR solve?
Issue Number: close #54850
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Test logical import on a table with 1200 columns
Baseline
With this PR