• Subhi Al Hasan's avatar
    check for known-slave in sentinel rewrite config (#11775) · 74b29985
    Subhi Al Hasan authored
    Fix the following config file error
    
    ```
    *** FATAL CONFIG FILE ERROR (Redis 6.2.7) ***
    Reading the configuration file, at line 152
    >>> 'sentinel known-replica XXXX 127.0.0.1 5001'
    Duplicate hostname and port for replica.
    ```
    
    
    that is happening when a user uses the legacy key "known-slave" in
    the config file and a config rewrite occurs. The config rewrite logic won't
    replace the old  line "sentinel known-slave XXXX 127.0.0.1 5001" and
    would add a new line with "sentinel known-replica XXXX 127.0.0.1 5001"
    which results in the error above "Duplicate hostname and port for replica."
    
    example:
    
    Current sentinal.conf
    ```
    ...
    
    sentinel known-slave XXXX 127.0.0.1 5001
    sentinel example-random-option X
    ...
    ```
    after the config rewrite logic runs:
    ```
    ....
    sentinel known-slave XXXX 127.0.0.1 5001
    sentinel example-random-option X
    
    # Generated by CONFIG REWRITE
    sentinel known-replica XXXX 127.0.0.1 5001
    ```
    
    This bug only exists in Redis versions >=6.2 because prior to that it was hidden
    by the effects of this bug https://github.com/redis/redis/issues/5388 that was fixed
    in https://github.com/redis/redis/pull/8271 and was released in versions >=6.2
    74b29985
config.c 143 KB