• Guy Benoish's avatar
    rewriteAppendOnlyFileBackground() failure fix · 0c030dea
    Guy Benoish authored
    It is possible to do BGREWRITEAOF even if appendonly=no. This is by design.
    stopAppendonly() didn't turn off aof_rewrite_scheduled (it can be turned on
    again by BGREWRITEAOF even while appendonly is off anyway).
    After configuring `appendonly yes` it will see that the state is AOF_OFF,
    there's no RDB fork, so it will do rewriteAppendOnlyFileBackground() which
    will fail since the aof_child_pid is set (was scheduled and started by cron).
    
    Solution:
    stopAppendonly() will turn off the schedule flag (regardless of who asked for it).
    startAppendonly() will terminate any existing fork and start a new one (so it is the most recent).
    0c030dea
aof.c 62.8 KB