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