This function gets called when the server is in Sentinel mode, started, * loaded the configuration, and is ready for normal operations. */
| 567 | /* This function gets called when the server is in Sentinel mode, started, |
| 568 | * loaded the configuration, and is ready for normal operations. */ |
| 569 | void 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 |
no test coverage detected