MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sentinelHandleRedisInstance

Function sentinelHandleRedisInstance

src/sentinel.cpp:5022–5054  ·  view source on GitHub ↗

Perform scheduled operations for the specified Redis instance. */

Source from the content-addressed store, hash-verified

5020
5021/* Perform scheduled operations for the specified Redis instance. */
5022void sentinelHandleRedisInstance(sentinelRedisInstance *ri) {
5023 /* ========== MONITORING HALF ============ */
5024 /* Every kind of instance */
5025 sentinelReconnectInstance(ri);
5026 sentinelSendPeriodicCommands(ri);
5027
5028 /* ============== ACTING HALF ============= */
5029 /* We don't proceed with the acting half if we are in TILT mode.
5030 * TILT happens when we find something odd with the time, like a
5031 * sudden change in the clock. */
5032 if (sentinel.tilt) {
5033 if (mstime()-sentinel.tilt_start_time < SENTINEL_TILT_PERIOD) return;
5034 sentinel.tilt = 0;
5035 sentinelEvent(LL_WARNING,"-tilt",NULL,"#tilt mode exited");
5036 }
5037
5038 /* Every kind of instance */
5039 sentinelCheckSubjectivelyDown(ri);
5040
5041 /* Masters and slaves */
5042 if (ri->flags & (SRI_MASTER|SRI_SLAVE)) {
5043 /* Nothing so far. */
5044 }
5045
5046 /* Only masters */
5047 if (ri->flags & SRI_MASTER) {
5048 sentinelCheckObjectivelyDown(ri);
5049 if (sentinelStartFailoverIfNeeded(ri))
5050 sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_ASK_FORCED);
5051 sentinelFailoverStateMachine(ri);
5052 sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_NO_FLAGS);
5053 }
5054}
5055
5056/* Perform scheduled operations for all the instances in the dictionary.
5057 * Recursively call the function against dictionaries of slaves. */

Callers 1

Calls 9

sentinelEventFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected