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

fix: unnecessary YAML Config reloads #9065

Merged

Conversation

boekkooi-lengoo
Copy link
Contributor

Description

In order to avoid unnecessary reloading of the yaml configuration. The time used to detect the last change to the config file is changed from change which is the time of the last file status change to the modification time wich is the time of the last data modification.

For more information also checkout http://lunarmodules.github.io/luafilesystem/manual.html#reference and https://linux.die.net/man/2/stat

Fixes: #9051

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@boekkooi-lengoo boekkooi-lengoo changed the title Use mtime instead of ctime YAML Config - Use mtime instead of ctime Mar 14, 2023
@boekkooi-lengoo boekkooi-lengoo changed the title YAML Config - Use mtime instead of ctime fix: unnecessary YAML Config reloads Mar 14, 2023
@monkeyDluffy6017
Copy link
Contributor

Test cases is needed, you could follow this: https://github.com/apache/apisix/blob/master/t/config-center-yaml/plugin.t

@boekkooi-lengoo
Copy link
Contributor Author

Hey @monkeyDluffy6017,
What type of test case should I add?
I'm not sure how to best reproduce the issue in a test using lua.

On a related not after reading https://apenwarr.ca/log/20181113 I'm thinking that we should add inode and size to the version as well. What do you think?

@monkeyDluffy6017
Copy link
Contributor

@shreemaan-abhishek
Copy link
Contributor

ping @boekkooi-lengoo

Show how a reload is triggered when it's not needed.
In order to avoid unnecessary reloading of the yaml configuration. The time used to detect the last change to the config file is changed from `change` which is the time of the last file status change to the `modification` time wich is the time of the last data modification.

For more information also checkou http://lunarmodules.github.io/luafilesystem/manual.html#reference and https://linux.die.net/man/2/stat

Fixes: apache#9051
@boekkooi-lengoo
Copy link
Contributor Author

@shreemaan-abhishek 🏓

@monkeyDluffy6017
Copy link
Contributor

please merge the master

@boekkooi-lengoo
Copy link
Contributor Author

@monkeyDluffy6017 Created merge commit 684c78d as requested

@monkeyDluffy6017 monkeyDluffy6017 merged commit bfb9a98 into apache:master Jan 12, 2024
44 checks passed
@boekkooi-lengoo boekkooi-lengoo deleted the avoid-unnecessary-reloads branch January 12, 2024 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

help request: Lots of load(): new plugins logs
4 participants