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

config: skip irrelevant config file events #322

Merged
merged 8 commits into from
Jul 10, 2023
Merged

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented Jul 3, 2023

What problem does this PR solve?

Issue Number: close #321

Problem Summary:

  • If the log file is in the same directory as the config file, TiProxy reloads the config file once the log outputs, and reloading itself causes log output, which is a dead loop.
  • If the directory is removed and then both the directory and the file are created within 200ms, the ConfigManager doesn't receive an event.

What is changed and how it works:

  • Check the file name for the watch event
  • Reload events if watch list is empty before adding
  • Support searching logger for test

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
  • Has tiproxyctl change
  • Other user behavior changes

Release note

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

None

@djshow832 djshow832 requested a review from xhebox July 3, 2023 13:57
Copy link
Collaborator

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

Test failed

lib/util/logger/logger.go Outdated Show resolved Hide resolved
@djshow832 djshow832 requested a review from xhebox July 7, 2023 07:44
Copy link
Collaborator

@xhebox xhebox 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

filename: fmt.Sprintf("%s%c%ccfg", tmpdir, filepath.Separator, filepath.Separator),
},
{
// Test removing and creating the directory.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a need to removing and recreating the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed.

@djshow832 djshow832 merged commit 2726b7a into pingcap:main Jul 10, 2023
@djshow832 djshow832 deleted the pd_addr branch July 10, 2023 03:35
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.

TiProxy infinitely reloads the config file
2 participants