xlog: use coeio in xdir_collect_garbage to unlink files from tx
Since xdir_collect_garbage() uses unlink() to remove files, vylog calls it from a coeio thread so as not to block tx. This is error-prone, because the vylog xdir is modified from tx so if garbage collection races with log rotation, the behavior is undefined. Let's add an argument to xdir_collect_garbage() specifying whether it should unlink files with unlink() or coeio_unlink(), and call it directly from tx, without the use of a coeio task. Also, add a return code to xdir_collect_garbage(), which is set to 0 on success or to -1 in case the function failed to delete a file. It will be used in the following patch.
Loading
Please register or sign in to comment