Skip to content
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: add ExternalEngineConfig to create an external engine #46636

Merged
merged 14 commits into from
Sep 7, 2023

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Sep 4, 2023

What problem does this PR solve?

Issue Number: ref #45719

Problem Summary:

What is changed and how it works?

Add ExternalEngineConfig. local backend CloseEngine will use ExternalEngineConfig to create an external engine, and then local backend can import it with the UUID.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 4, 2023
@tiprow
Copy link

tiprow bot commented Sep 4, 2023

Hi @lance6716. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #46636 (820326d) into master (777e6da) will decrease coverage by 0.5925%.
Report is 4 commits behind head on master.
The diff coverage is 60.7476%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46636        +/-   ##
================================================
- Coverage   73.2843%   72.6918%   -0.5925%     
================================================
  Files          1319       1340        +21     
  Lines        395850     402517      +6667     
================================================
+ Hits         290096     292597      +2501     
- Misses        87263      91387      +4124     
- Partials      18491      18533        +42     
Flag Coverage Δ
integration 27.8551% <0.0000%> (?)
unit 73.3323% <63.1068%> (+0.0480%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 85.0414% <ø> (+0.0869%) ⬆️
br 48.1355% <60.7476%> (-4.3300%) ⬇️

Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 5, 2023
@lance6716 lance6716 changed the title [WIP]lightning: add ExternalEngineConfig to create an external engine lightning: add ExternalEngineConfig to create an external engine Sep 5, 2023
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 5, 2023
}
}()
go func() {
err2 := local.CloseEngine(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the expected usage

Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 5, 2023
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@@ -177,13 +185,13 @@ func (e *Engine) createMergeIter(ctx context.Context, start kv.Key) (*MergeKVIte
return iter, nil
}

// KVStatistics returns the total kv size and total kv length.
// KVStatistics returns the total kv size and total kv count.
func (e *Engine) KVStatistics() (totalKVSize int64, totalKVLength int64) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (e *Engine) KVStatistics() (totalKVSize int64, totalKVLength int64) {
func (e *Engine) KVStatistics() (totalKVSize int64, totalKVCount int64) {

allEngines := local.lockAllEnginesUnless(importMutexStateClose, 0)
allEngines := make([]common.Engine, 0, 8)
for _, e := range local.externalEngine {
allEngines = append(allEngines, e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not close it directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file, err := os.Create(filepath.Join(l.base, name))
filename := filepath.Join(l.base, name)
dir := filepath.Dir(filename)
err := os.MkdirAll(dir, 0750)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in other storage backend like s3, name can contain /. But LocalStorage will raise error. I found it when using LocalStorage in the unit tests of this PR

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 6, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta, 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:
  • OWNERS [tangenta,wjhuang2016]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 6, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 6, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-05 09:13:08.276384633 +0000 UTC m=+2436752.825400619: ☑️ agreed by tangenta.
  • 2023-09-06 07:16:12.684356247 +0000 UTC m=+2516137.233372228: ☑️ agreed by wjhuang2016.

@tangenta
Copy link
Contributor

tangenta commented Sep 6, 2023

/retest

@tiprow
Copy link

tiprow bot commented Sep 6, 2023

@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lance6716
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Sep 7, 2023

@lance6716: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lance6716
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Sep 7, 2023

@lance6716: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wjhuang2016
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot merged commit e01d179 into pingcap:master Sep 7, 2023
17 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants