From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5B8DD6EC55; Wed, 16 Jun 2021 09:22:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5B8DD6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623824540; bh=rVw+25EkgrLcmfIIgquxpYMcTmEKBypUn5ak9g9kanw=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cfbdTTYnYxQxb3YuWKbjZuqiLgxKi56MRXWcileos4AntVawN99dO6rXXaPuuMdrS UBm4X1vnEHi1f40t4XC3dEOvK0oc7OFhdgGDZxbyx+IMlCpymeS5tCRdARnhmYBPwk vO4+IyNTZD/i+j1PpZDg1s2rENdQPSqCVjIPjib4= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 31AF36EC55 for ; Wed, 16 Jun 2021 09:22:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 31AF36EC55 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1ltOwL-00077O-3y; Wed, 16 Jun 2021 09:22:17 +0300 To: Cyrill Gorcunov References: Message-ID: <9940ffc4-9d92-58b7-e95a-1128048e21da@tarantool.org> Date: Wed, 16 Jun 2021 08:22:15 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54907A7AE9C1BA82BC67C1327DFB87C6A6182A05F5380850409CA42A703A320FD255F626988333E6389F08105F5F671637B94B66305C9D4CC5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B7733D0215A2F71AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375121C8F3070B83748638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8009FC76655202D41D223133B862EA6FF117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC60CDF180582EB8FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86DF04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A565EE6E9D4A3001124E1D41402114AFF3E0109AA5B7D6D621D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E318F287A436F24C9AE51B6B1981C7FD7E56CE5C051E50D015E04BEC0DDCC89AAD64B538C7DB1F3E1D7E09C32AA3244C9AE778CE18004D2963896E64E0EAA85CD08D48398F32B4A6FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojzTTns/+yd+YbE7g1h7f7Cg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822D01845CC9B66DA1C6F7CEF1C269DFA2B3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 04/13] wal: refactor wal_write_to_disk() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 15.06.2021 22:46, Cyrill Gorcunov wrote: > On Fri, Jun 11, 2021 at 11:56:12PM +0200, Vladislav Shpilevoy wrote: >> It didn't have a single fail path. That led to some amount of code >> duplication, and it complicated future patches where the journal >> entries are going to get a proper error reason instead of default >> -1 without any details. >> >> The patch is a preparation for #6027 where it is wanted to have >> more detailed errors on journal entry/transaction fail instead >> of ER_WAL_IO for everything. Sometimes it can override a real >> error like a cascade rollback, or a transaction conflict. >> >> Part of #6027 >> --- >> @@ -1038,7 +1036,10 @@ wal_write_to_disk(struct cmsg *msg) >> { >> struct wal_writer *writer = &wal_writer_singleton; >> struct wal_msg *wal_msg = (struct wal_msg *) msg; >> struct error *error; >> + assert(!stailq_empty(&wal_msg->commit)); > > Hi Vlad, you know I don't understand why we need this assert... Otherwise in case of, for instance, rotate fail, the rollback won't start. >> /* >> * Track all vclock changes made by this batch into >> @@ -1058,23 +1059,17 @@ wal_write_to_disk(struct cmsg *msg) >> >> if (writer->is_in_rollback) { >> /* We're rolling back a failed write. */ >> - stailq_concat(&wal_msg->rollback, &wal_msg->commit); >> - vclock_copy(&wal_msg->vclock, &writer->vclock); >> - return; >> + goto done; > > Jumps to "done" label change the code logic. Before the patch if we > reached the write and say wal_opt_rotate failed we set up is_in_rollback > sign and exit early, after the patch we start notifying watchers that > there "write" happened which means relay code will be woken up while there > no new data on disk level at all, which means watchers wanna be notified > for no reason, no? Or I miss something obvious? You didn't miss anything. But I see no harm in that. WAL write fail is extremely rare, so a rare spurious wakeup won't do anything bad. I decided the code reusability and simplicity is more important here.