-
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
ddl/ingest: add the management infra for lightning struct #37521
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/693c43347da1b1e78789d42cacd309cd39858684 |
@@ -318,6 +318,15 @@ func TidbOptInt64(opt string, defaultVal int64) int64 { | |||
return val | |||
} | |||
|
|||
// TidbOptUint64 converts a string to an uint64. | |||
func TidbOptUint64(opt string, defaultVal uint64) uint64 { |
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.
s/TidbOptUint64/TiDBOptUint64
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 is consistent with TidbOptInt64
, TidbOptInt
and tidbOptFloat64
, should I rename the others?
ddl/lightning/engine_mgr.go
Outdated
// Calculate lightning concurrency degree and set memory usage | ||
// and pre-allocate memory usage for worker. | ||
m.MemRoot.RefreshConsumption() | ||
ok := m.MemRoot.TestConsume(int64(bc.cfg.TikvImporter.LocalWriterMemCacheSize)) |
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 can rename this function TestConsume
, like checkConsume
or other names. The name confused me a little bit, thinking it was code for testing.
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 is suggested by @xiongjiwei ... let me change it to CheckConsume
.
ddl/lightning/engine_mgr.go
Outdated
ei.Clean() | ||
m.Delete(indexID) | ||
m.MemRoot.ReleaseWithTag(encodeEngineTag(jobID, indexID)) | ||
m.MemRoot.Release(StructSizeWriterCtx * int64(ei.writerCount)) |
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 don't see Consume
StructSizeWriterCtx
in Register
, so why do we need to release it here?
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.
Done. b1bfdba
Co-authored-by: Lynn <zimu_xia@126.com>
ddl/lightning/backend_mgr.go
Outdated
} | ||
} | ||
|
||
type glueLit struct{} |
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 add comments for glueLit
.
Besides, do we need to implement this struct's functions?
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 we need to implement this struct's functions?
No, it is a noop struct.
ddl/lightning/backend_mgr.go
Outdated
if !exist { | ||
return | ||
} | ||
bc.EngMgr.UnregisterAll(jobID) |
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 don't see where EngMgr.Register
is called. Has it not been called yet or am I reading it wrong?
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 engineInfo
is initialized in writePhysicalTableRecord
. It will be used in the next PR:
ddl/lightning/env.go
Outdated
@@ -0,0 +1,115 @@ | |||
// Copyright 2022 PingCAP, Inc. |
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.
Could we add some UT for this file?
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.
Updated. BTW genRLimit
is a wrapper for system call, it is meaningless to test it..
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 9d02ffb
|
/hold cc @pingcap/tidb-configuration-reviewer |
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
@Benjamin2037: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. 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 ti-community-infra/tichi 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.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 51f1095
|
/hold |
/unhold |
TiDB MergeCI notify
|
What problem does this PR solve?
Issue Number: ref #35983
What is changed and how it works?
This PR encapsulate the lightning structs such as
Backend
,Engine
andWriter
, so that it could be easily used byonCreateIndex()
.Check List
Tests
It is not easy to write unit tests because it needs the cluster environment.
The integration test has been added in #37320. We will switch the add index process after the whole development is finished & merged.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.