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 DCAD66EC55; Sat, 12 Jun 2021 01:03:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DCAD66EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623449027; bh=gfhXWGfn5Nbf0BUR0B1IgI6outTt6OUGO2gsuV9GWIQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=s/Qwufc5SuCEfK5Mjhqh49Utys9avioBLmnZKyxjHDL+MUPY0xwktz6y15/CoPpzf tHsw2pt3/MdgHgqxpG1pEZmo+Aqy4RtBgHf7lxJlD9BDCf3K05LaeRJoKVgGSIUAtS 9Ibbd2qqOqf8QC2NeSSxjAKXVAbC0KFyhEAee7kw= 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 2D7D36F3D0 for ; Sat, 12 Jun 2021 00:56:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2D7D36F3D0 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lrp8o-0008JK-DU; Sat, 12 Jun 2021 00:56:38 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Fri, 11 Jun 2021 23:56:17 +0200 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54907A7AE9C1BA82BC67C1327DFB87C6A6182A05F538085040A6749C15A36C2C4686245EE16D43E7786B3E9A3A50D8F80C6D862B6CFC51FC07 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70FFC2100EB7B6895EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063792EDBE6976DC04EF8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB553375668874A2D3FA5089FEA8062BDBFFA2BD681134D46843AA7775A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE73CD73D99384BA5CA9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3ADEF88395FA75C5F117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006373BC478629CBEC79DEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978317387390EF8EF1240654CE1D82DC659E2 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8183A4AFAF3EA6BDC44C234C8B12C006B7A1906CDB4DF5A72907662F4F11F81404CD70BE10F312F28E8B1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDB791E6C230873D55CDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34738A88CA0C70A558BB8693F6000CDD67C1552BE82501B58499D99D9AAEF27EF7A44107C2F114164C1D7E09C32AA3244C1068ED5C5BCDF3F9297377E8394BAFE4408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojQR1NM653rVHo4wJWvlD0kQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382260DE276D6113F1830C00C8A784053BF03841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 09/13] txn: assert after WAL write that txn is not done 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" In the journal write trigger the transaction assumed it might be already rolled back and completed, hence does not need to do anything except free itself. But it can't happen. The only imaginable reason why a transaction might be rolled back before it completed its WAL write is a ROLLBACK entry issued after the transaction. But ROLLBACK applies its effects only after it is written. Hence only after all the other pending txns are written too. Therefore it is not possible for a transaction to get ROLLBACK before it finishes its own WAL write. Probably it was possible in the time when applier used to execute ROLLBACK before writing it to WAL. But that was fixed in b259e9306f717883026520c975f2610c9fbc7d43 ("applier: process synchro rows after WAL write"). Can't happen now. This became easier to realize when not finished transaction signature got its own value TXN_SIGNATURE_UNKNOWN. --- src/box/txn.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index c9c2e93ff..1c1eb15bc 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -532,15 +532,7 @@ static void txn_on_journal_write(struct journal_entry *entry) { struct txn *txn = entry->complete_data; - /* - * txn_limbo has already rolled the tx back, so we just - * have to free it. - */ - if (txn->signature != TXN_SIGNATURE_UNKNOWN) { - assert(txn->signature < 0); - txn_free(txn); - return; - } + assert(txn->signature == TXN_SIGNATURE_UNKNOWN); txn->signature = entry->res; /* * Some commit/rollback triggers require for in_txn fiber -- 2.24.3 (Apple Git-128)