• Binbin's avatar
    Fix race in temp rdb delete shutdown test (#11840) · 78f15b7e
    Binbin authored
    I saw this error once, in the FreeBSD Daily CI:
    ```
    *** [err]: Temp rdb will be deleted if we use bg_unlink when shutdown in tests/unit/shutdown.tcl
    Expected [file exists /xxx/temp-10336.rdb] (context: type eval line 15 cmd {assert {[file exists $temp_rdb]}} proc ::test)
    ```
    
    The log shows that bgsave was executed, and it was successfully executed in the end:
    ```
    Starting test Temp rdb will be deleted if we use bg_unlink when shutdown in tests/unit/shutdown.tcl
    10251:M 22 Feb 2023 11:37:25.441 * Background saving started by pid 10336
    10336:C 22 Feb 2023 11:37:27.949 * DB saved on disk
    10336:C 22 Feb 2023 11:37:27.949 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
    10251:M 22 Feb 2023 11:37:28.060 * Background saving terminated with success
    ```
    
    There may be two reasons:
    1. The child process has been created, but it has not created
       the temp rdb file yet, so [file exists $temp_rdb] check failed.
    2. The child process bgsave has been executed successfully and the
       temp file has been deleted, so [file exists $temp_rdb] check failed.
    
    From the logs pint, it should be the case 2, case 1 is too extreme,
    set rdb-key-save-delay to a higher value to ensure bgsave does not
    succeed early to avoid this case.
    78f15b7e
shutdown.tcl 3.57 KB