MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sentinelIsRunning

Function sentinelIsRunning

app/redis-6.2.6/src/sentinel.c:569–590  ·  view source on GitHub ↗

This function gets called when the server is in Sentinel mode, started, * loaded the configuration, and is ready for normal operations. */

Source from the content-addressed store, hash-verified

567/* This function gets called when the server is in Sentinel mode, started,
568 * loaded the configuration, and is ready for normal operations. */
569void sentinelIsRunning(void) {
570 int j;
571
572 /* If this Sentinel has yet no ID set in the configuration file, we
573 * pick a random one and persist the config on disk. From now on this
574 * will be this Sentinel ID across restarts. */
575 for (j = 0; j < CONFIG_RUN_ID_SIZE; j++)
576 if (sentinel.myid[j] != 0) break;
577
578 if (j == CONFIG_RUN_ID_SIZE) {
579 /* Pick ID and persist the config. */
580 getRandomHexChars(sentinel.myid,CONFIG_RUN_ID_SIZE);
581 sentinelFlushConfig();
582 }
583
584 /* Log its ID to make debugging of issues simpler. */
585 serverLog(LL_WARNING,"Sentinel ID is %s", sentinel.myid);
586
587 /* We want to generate a +monitor event for every configured master
588 * at startup. */
589 sentinelGenerateInitialMonitorEvents();
590}
591
592/* ============================== sentinelAddr ============================== */
593

Callers 1

mainFunction · 0.85

Calls 3

getRandomHexCharsFunction · 0.85
sentinelFlushConfigFunction · 0.85

Tested by

no test coverage detected