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

api: refactor config API to adapt tidb-operator/TOML changes #176

Merged
merged 29 commits into from
Jan 11, 2023

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Jan 6, 2023

Signed-off-by: xhe xw897002528@gmail.com

What problem does this PR solve?

Issue Number: ref #161

Problem Summary: Due to we have adapt ConfigWrapper in tidb-operator, it becomes harder to set config for each component separately. Further more, we need to issue two requests for each instace. Instead, we just upload the whole config, and pick updatable part now.

What is changed and how it works:

  1. config [log | proxy] [get | put] is replaced by one single command tiproxyctl config get/put
  2. Watch channels for XXXOnlineConfig are replaced by chan *config.Config
  3. Init values are inited in ConfigManager.Init()
  4. Stablize log config by removing file size check

Check List

Tests

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

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has tiproxyctl change
  • Other user behavior changes

Release note

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

None

Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox requested a review from djshow832 January 6, 2023 09:50
@@ -118,12 +117,11 @@ func TestUpdateCfg(t *testing.T) {
err := os.RemoveAll(dir)
require.NoError(t, err)

clonedCfg := cfg.LogOnline
test.updateCfg(&clonedCfg)
// Push it 2 times to make sure the first one has already taken affect.
Copy link
Collaborator Author

@xhebox xhebox Jan 6, 2023

Choose a reason for hiding this comment

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

Our kvmap impl will not suffer problems like etcd, no need to put 2 times.

Signed-off-by: xhe <xw897002528@gmail.com>
for {
select {
case <-ctx.Done():
return
case cfg := <-cfgCh:
case acfg := <-cfgch:
cfg := &acfg.Log.LogOnline
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the event type is delete, acfg is empty.

Copy link
Collaborator Author

@xhebox xhebox Jan 9, 2023

Choose a reason for hiding this comment

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

No delete in the current implementation.

And it is ensured to be valid pointer:

	var c config.Config
		if k.Type == KVEventDel {
			ch <- &c
		} else {

It is valid if user wants to reset to default, for example.

pkg/manager/logger/manager_test.go Show resolved Hide resolved
xhebox added 4 commits January 9, 2023 11:34
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
xhebox added 16 commits January 10, 2023 15:43
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@djshow832 djshow832 merged commit b26d28e into pingcap:main Jan 11, 2023
@xhebox xhebox deleted the dedicate_4 branch March 7, 2023 03:18
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 7, 2023
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants