-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner: introduce external storage for plan replayer #65477
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
Conversation
|
Hi @zeminzhou. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions 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. |
D3Hunter
left a comment
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.
/hold
need more discussion about the new config, and how it can be used
pkg/external/external_storage.go
Outdated
|
|
||
| var ( | ||
| globalMu sync.RWMutex | ||
| globalExternalStorage *externalStorage |
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 var can create when it's needed, don't use global var
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 are many places where storage is used, but creating it frequently is too cumbersome.
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.
no need to be global, you can still create a local var that's reused
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #65477 +/- ##
================================================
- Coverage 77.7956% 77.6529% -0.1428%
================================================
Files 2000 1923 -77
Lines 545038 533274 -11764
================================================
- Hits 424016 414103 -9913
+ Misses 119360 119158 -202
+ Partials 1662 13 -1649
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/ok-to-test |
88e480b to
92f4d33
Compare
|
/test pull-integration-ddl-test |
|
@zeminzhou: The specified target(s) for Use DetailsIn 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. |
|
/test pull-unit-test-next-gen |
|
@zeminzhou: The specified target(s) for Use DetailsIn 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. |
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.
what's the point to wrap on top of object storage again, why not use it directly?
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.
Two reasons:
This storage is used in many places, and creating it every time is too cumbersome.
We need to confirm the path at the beginning to prevent the path from changing during the process, causing inconsistencies between where files are written and where they are read.
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.
if the URI is changed, the file store location should follow the change. keep using the old uri is not an expected behavior
and the uri will not be changed on the cloud, this can be controlled by us
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 storage is used in many places, and creating it every time is too cumbersome.
you can write a method like this to encapsulate all the detail of storage creation
tidb/pkg/dxf/framework/handle/handle.go
Lines 392 to 402 in 28cce6a
| func newObjStore(ctx context.Context, uri string, opts *storeapi.Options) (storeapi.Storage, error) { | |
| storeBackend, err := objstore.ParseBackend(uri, nil) | |
| if err != nil { | |
| return nil, err | |
| } | |
| store, err := objstore.New(ctx, storeBackend, opts) | |
| if err != nil { | |
| return nil, err | |
| } | |
| return store, nil | |
| } |
cmd/tidb-server/main.go
Outdated
| } | ||
| logutil.BgLogger().Info("initialize external storage", zap.String("path", path), zap.String("namespace", namespace)) | ||
|
|
||
| err := external.CreateExternalStorage(path, namespace, 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.
you can create it on demand, no need to setup at tidb startup
|
/test all |
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
9f2cd2d to
7018858
Compare
pkg/external/external_storage.go
Outdated
| func init() { | ||
| if tempDir := config.GetGlobalConfig().TempDir; tempDir != "" { | ||
| _ = CreateExternalStorage(tempDir, "", 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.
This already has a default value at startup; the init function seems problematic. Value initialization should be placed in a unified location.
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.
good catch! thanks
|
/lgtm cancel |
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
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.
if you insist to use this wrapper, please move it to where it's used, AKA, planner
and external is not a good term to describe what it does, maybe extstore, and then the files under it can also be renamed
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, hawkingrei The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
|
/unhold |
What problem does this PR solve?
Issue Number: close #65478
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.