[PATCH 1/3] xlog: erase eof marker when reopening existing file for writing

Konstantin Osipov kostja at tarantool.org
Wed Jun 27 20:09:18 MSK 2018


* Vladimir Davydov <vdavydov.dev at gmail.com> [18/06/15 23:28]:
> 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().
> ---
>  src/box/xlog.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Looks good, will push shortly.

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list