From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 27 Jun 2018 20:09:18 +0300 From: Konstantin Osipov Subject: Re: [PATCH 1/3] xlog: erase eof marker when reopening existing file for writing Message-ID: <20180627170918.GD28358@chai> References: <3ce2e8070f75cbd3022add41faf940a8809a8d1c.1529075903.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ce2e8070f75cbd3022add41faf940a8809a8d1c.1529075903.git.vdavydov.dev@gmail.com> To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: * Vladimir Davydov [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