-
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: remote backend #58789
base: master
Are you sure you want to change the base?
lightning: remote backend #58789
Conversation
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @zeminzhou. 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. |
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
[FORMAT CHECKER NOTIFICATION] Notice: To remove the 📖 For more info, you can check the "Contribute Code" section in the development guide. Notice: To remove the For example:
📖 For more info, you can check the "Contribute Code" section in the development guide. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #58789 +/- ##
================================================
+ Coverage 73.0885% 73.0927% +0.0041%
================================================
Files 1676 1710 +34
Lines 463643 472765 +9122
================================================
+ Hits 338870 345557 +6687
- Misses 103924 105630 +1706
- Partials 20849 21578 +729
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@zeminzhou: The following tests 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. |
Please add UT for remote backend. |
} | ||
|
||
func (c *chunkSender) putChunk(ctx context.Context, data []byte) (uint64, error) { | ||
data0 := make([]byte, len(data)) |
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.
Please give this variable a meaningful name to represent its specific meaning
updateFlushedChunkDuration = 10 * time.Second | ||
) | ||
|
||
func genLoadDataTaskID(keyspaceID uint32, taskID int64, cfg *backend.EngineConfig) string { |
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 this all look like util functions? Can it be merged into a single file with util.go
?"
) | ||
|
||
func genLoadDataTaskID(keyspaceID uint32, taskID int64, cfg *backend.EngineConfig) string { | ||
return fmt.Sprintf("%d-%d-%d-%d", keyspaceID, taskID, cfg.TableInfo.ID, cfg.Remote.EngineID) |
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.
"%d-%d-%d-%d"
needs to be set as a const.
return io.ReadAll(resp.Body) | ||
} | ||
|
||
func parseLDWUrl(resp *http.Response, enableTLS bool) string { |
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 need to explain the definition of LDW or avoid using the abbreviation. Additionally, have we described LDW in the code comments? Or, what exactly is the role of load_data_worker?This might cause confusion for other developers.
} | ||
|
||
func parseLDWUrl(resp *http.Response, enableTLS bool) string { | ||
base := strings.TrimSuffix(resp.Header.Get("Location"), "/load_data") |
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.
This string can be set as a constant
|
||
nextChunkID := result.HandledChunkID + 1 | ||
for nextChunkID <= expectChunkID { | ||
url := fmt.Sprintf("%s/load_data?cluster_id=%d&task_id=%s&writer_id=%d&chunk_id=%d", |
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.
These URL strings can be set as constants
@@ -158,7 +161,7 @@ func (d *DBStore) adjust( | |||
s *Security, | |||
tlsObj *common.TLS, | |||
) error { | |||
if i.Backend == BackendLocal { | |||
if i.Backend == BackendLocal || i.Backend == BackendRemote { |
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.
Can this conditional statement be encapsulated into isPhysicalBackend
@@ -65,6 +65,7 @@ type GlobalMydumper struct { | |||
type GlobalImporter struct { | |||
Backend string `toml:"backend" json:"backend"` | |||
SortedKVDir string `toml:"sorted-kv-dir" json:"sorted-kv-dir"` | |||
RemoteAddr string `toml:"remote-addr" json:"remote-addr"` |
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.
I'm not sure if remote-addr
is an appropriate name, or if we could use a clearer name, such as remote-load-data-worker-addr?
@@ -1832,3 +1859,44 @@ func (tr *TableImporter) preDeduplicate( | |||
) | |||
return err | |||
} | |||
|
|||
func estimateEngineDataSize(tblMeta *mydump.MDTableMeta, tblInfo *checkpoints.TidbTableInfo, isIndexEngine bool, logger log.Logger) 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.
Are these functions only used by the remote backend? If they are solely related to remote logic, it would be better to place them in the remote
directory and the corresponding files for easier management.
What problem does this PR solve?
Issue Number: close #xxx
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.