-
Notifications
You must be signed in to change notification settings - Fork 621
Add Runner hooks for -k rotate event #2380
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,16 @@ class RegisteredRunner | |
| /// Meant for adjusting the module state based on configuration changes. | ||
| virtual void syncConfig() {} | ||
|
|
||
| /* Log Rotation events */ | ||
|
|
||
| /// Called after receiving a log rotate request. | ||
| /// Meant for modules that manage log files to rename/rotate them. | ||
| virtual void rotateLogs() {} | ||
|
|
||
| /// Called after rotating log files. | ||
| /// Meant for modules that need to (re-)attach to log files after rotation. | ||
| virtual void finishLogRotate() {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt it is a good idea to have "unattached" modules that are waiting for this event.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we already agreed there are better ways than Squid currently does. Unfortunately my attempts to form an architectural design that works in any way different have been constantly vetoed for more than a decade. So we are left with modules and helpers that log directly to the log files and detach/reattach on rotation. This PR is a prerequisite to reducing circular dependencies in the Squid linker libraries within the constraints of that status quo. |
||
|
|
||
| /* Shutdown events */ | ||
|
|
||
| /// Called after receiving a shutdown request and before stopping the main | ||
|
|
||
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.
We should fix (or at least agree on how to fix) SMP log rotation problems before introducing a new (and unused) log rotation API. Merging #1223 could be a step in that direction, but we know that more work is needed. My current preference would be for options B+D that do not match the API proposed in this PR.
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.
The SMP issues are not relevant to the issues being resolved by the refactor this PR is part of.
Right now we have a circular dependency where
SignalEnginecalls some components, which in turn rely onComm, which relies onSignalEngine.SignalEnginealready usesRunnersRegistryfor components to subscribe/register their signal handlers (ie. -k shutdown, -k reconfigure, -k check). This PR is just adding the missing hooks for the-k rotatesignal handlers to self-register instead of hard-coding that circular dependency.