xlog: erase eof marker when reopening existing file for writing
When reopening an existing xlog file (as in case of vylog), we do not erase the eof marker immediately. Instead we reposition file offset to (file_size - sizeof eof_marker), assuming the eof marker will be overwritten on the first write. However, it isn't enough if we want to reuse this function for reopening WAL files, because when scanning the WAL directory we close a file if we read eof marker and never reopen it again, see recover_remaining_wals(). So to avoid skipping rows written to a once closed WAL, we have to erase the eof marker when reopening an xlog file. Let's do it with truncate().
Loading
Please register or sign in to comment