-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Disable logging in ClusterFormationFailureHelper
on shutdown.
#125244
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
Conversation
Modifies Coordinator to enable logging in ClusterFormationFailureHelper when started and disables logging in ClusterFormationFailureHelper when stopped. The warning scheduler handling and invariant check in the Coordinator are left as is, with the logging boolean set independently, eliminating the need to hold the mutex in doStop() when Coordinator.stop() is called when the Node is shutdown. Closes elastic#105559.
public void setLoggingEnabled(boolean enabled) { | ||
this.loggingEnabled = enabled; |
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.
Initially it seemed that a
synchronized(mutex) {
clusterFormationFailureHelper.stop();
}
block in Coordinator::doStop()
would be sufficient, but besides needing to hold the lock when the Node is being shut down, it seems a race condition could exist where the failure helper is stopped on shutdown but another thread immediately calls becomeCandidate()
and starts it back up?
Also if calls to ClusterFormationFailureHelper
start()
and stop()
were not synchronized it looks like there is the potential for a NullPointerException
in start()
if the warningScheduler
is set to null
between the assignment of a new WarningScheduler
instance and the next line that calls scheduleNextWarning
(Intellij warns about this):
public void start() {
assert warningScheduler == null;
warningScheduler = new WarningScheduler();
warningScheduler.scheduleNextWarning();
}
public void stop() {
warningScheduler = null;
}
Hi @JeremyDahlgren, I've created a changelog YAML for you. |
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
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.
Neat solution, LGTM
…c#125244) Modifies Coordinator to enable logging in ClusterFormationFailureHelper when started and disables logging in ClusterFormationFailureHelper when stopped. The warning scheduler handling and invariant check in the Coordinator are left as is, with the logging boolean set independently, eliminating the need to hold the mutex in doStop() when Coordinator.stop() is called when the Node is shutdown. Closes elastic#105559. * Update docs/changelog/125244.yaml
…c#125244) Modifies Coordinator to enable logging in ClusterFormationFailureHelper when started and disables logging in ClusterFormationFailureHelper when stopped. The warning scheduler handling and invariant check in the Coordinator are left as is, with the logging boolean set independently, eliminating the need to hold the mutex in doStop() when Coordinator.stop() is called when the Node is shutdown. Closes elastic#105559. * Update docs/changelog/125244.yaml
…c#125244) Modifies Coordinator to enable logging in ClusterFormationFailureHelper when started and disables logging in ClusterFormationFailureHelper when stopped. The warning scheduler handling and invariant check in the Coordinator are left as is, with the logging boolean set independently, eliminating the need to hold the mutex in doStop() when Coordinator.stop() is called when the Node is shutdown. Closes elastic#105559. * Update docs/changelog/125244.yaml
Modifies
Coordinator
to enable logging inClusterFormationFailureHelper
when started and disables logging inClusterFormationFailureHelper
when stopped. The warning scheduler handling and invariant check in theCoordinator
are left as is, with the logging boolean set independently, eliminating the need to hold themutex
indoStop()
whenCoordinator.stop()
is called when theNode
is shutdown.Closes #105559.