From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 27 Jun 2018 20:22:16 +0300 From: Konstantin Osipov Subject: Re: [PATCH 2/3] wal: rollback vclock on write failure Message-ID: <20180627172215.GE28358@chai> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: * Vladimir Davydov [18/06/15 23:28]: > In order to determine whether we need to rebootstrap the instance on > startup, we need to know its vclock. To find it out, we scan the last > xlog file before proceeding to local recovery, but this means in case > rebootstrap is not required we scan the last xlog twice, which is > sub-optimal. To avoid double scan, we can create a new empty xlog before > shutting down the server and reopen it after restart. However, since we > promote WAL writer vclock even if xlog write fails, there will be an LSN > gap between the last xlog and the one created on shutdown in case we > failed to write last few records. To avoid that, let's rollback WAL > writer vclock if write fails. BTW this will make it consistent with > replicaset vclock - see commit 3c4bac715960a ("Follow vclock only for > success wal writes"). Please add previous xlog's vclock to the next xlog header and use it to watch gaps/missing xlogs in recover_remaining_wals(). If the necessary header is missing, simply ignore the gaps. Ignore LSN gaps, they are harmless, and using LSN gaps as a mark of xlog dir corruption was a bad idea from the start. Logical markers should not be used to verify consistency of the physical layer. -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov