• Wang Yuan's avatar
    Remove tmp rdb file in background thread (#7762) · b002d2b4
    Wang Yuan authored
    We're already using bg_unlink in several places to delete the rdb file in the background,
    and avoid paying the cost of the deletion from our main thread.
    This commit uses bg_unlink to remove the temporary rdb file in the background too.
    
    However, in case we delete that rdb file just before exiting, we don't actually wait for the
    background thread or the main thread to delete it, and just let the OS clean up after us.
    i.e. we open the file, unlink it and exit with the fd still open.
    
    Furthermore, rdbRemoveTempFile can be called from a thread and was using snprintf which is
    not async-signal-safe, we now use ll2string instead.
    b002d2b4
rdb.h 7.46 KB