Sentinel master reboot fix#9438
Conversation
yossigo
left a comment
There was a problem hiding this comment.
@hwware Code looks good, a few nitpicks.
Basically we identify a rebooting master as a new distinct kind of failure mode, for which we apply reboot-down-after-milliseconds configuration. I have a couple of conceptual questions here:
- Is it really necessary to do that, vs. just treating
-LOADINGas any other error and failing over? - If we do, won't it make sense to do this configurable rather than hard coded?
I will be happy to also get the perspective of recent reporters of this issue, @daniel-house and others.
There was a problem hiding this comment.
| #define SRI_MASTER_REBOOT (1<<13) /* this flag set thinks that master is rebooted in very shot time*/ | |
| #define SRI_MASTER_REBOOT (1<<13) /* Master was detected as rebooting */ |
nit: typo/rephrase.
|
Does anyone know why If |
|
@daniel-house If you restart both masters and replicas, you'd probably get On the other hand, if the replica is up and running and it's only the master that's |
I think for this case, if you restart both masters and replicas in very short time, we could assume it takes only less than 0.1 or 0.5 seconds, then you could get |
@yossigo For this issue, i find it almost exists in all previous versions, if do you think merge these changed codes to those versions, thanks. |
|
@yossigo Let me describe the whole process for this solution. Thanks. |
|
@hwware I had another discussion about this with @oranagra. One way to look at this fix is that it improves availability over durability of data because, at least in some scenarios, the master will have the most up to date dataset and we just need to wait for it to load. The concern is that different deployments may have conflicting needs: some may want to push availability further and not even wait 10*ping time before failing over a master that's loading, and others may want to wait longer (or forever). We could achieve that if |
I totally agree what you suggest, making |
d5c7afe to
6a8efaf
Compare
@hwware Hi Yossi, follow your suggestion, I change "`master_reboot_down_after_period" as configurable, and client could |
|
@hwware I've pushed a commit with minor cleanups, I think the only thing missing to merge this is a test. |
a8a8a48 to
de4c036
Compare
* Clarify configuration parameter documentation. * Whitespace cleanups.
de4c036 to
666df41
Compare
|
@yossigo Hi Yossi, I just add the test for this PR, please take a look, thanks |
Add master-reboot-down-after-period as a configurable parameter, to make it possible to trigger a failover from a master that is responding with `-LOADING` for a long time after being restarted.
SRI_MASTER_REBOOT flag was added in redis#9438
SRI_MASTER_REBOOT flag was added in #9438
Background Information:
We have two issues #1297 and #4561
They mentioned that Sentinel does not trigger failover in case of master node reboot in very shot time.
This PR is to fix this problem for sentinel.
Sentinel send PING request to master, replicas and other sentinels according to the "down-after-milliseconds" parameters in
sentinel.conf or its own config file.
If down-after-milliseconds is greater than 1000, Sentinel will send PING every second.
If down-after-milliseconds is less than 1000, Sentinel will send PING according to the down-after-milliseconds value
For example:
// Sentinel send PING request every 1 second
Sentinel down-after-milliseconds mymaster 60000
// Sentinel send PING request every 600 milliseconds
Sentinel down-after-milliseconds mymaster 600
Solution:
If master reboot in very short time, Sentinel will receive one "reboot" information.
At this time, add SRI_MASTER_REBOOT to this Sentinel instance and record the master reboot time in master_reboot_since_time variable.
If Sentinel receives "Loading" reply with SRI_MASTER_REBOOT flag from master for 10 * PING time,
Sentinel think master is subjectively down, and ready to vote and failover process.
This solution could grantee if master is reboot in very short time, failover could finish in 10 seconds.