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 88A716C7D7; Tue, 27 Apr 2021 00:03:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 88A716C7D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1619471021; bh=acrW1eARi3x795rP4pYByYobD4fc96c8aJEHp82k1b4=; 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=JRl4O9AK/RtKlpA18XZu1FpGMNvr4Gby2ksd/TS1YsPj/b86C+1oQpHSGQ95O1wZA zcbSCHE0po9gvgcoaH61J8bELGSZZ+S0P97s5fg7Z1/ck/OupLP4wQySQu4iSkRKjW O9MDlP5T1t+z5TUzECAkntxGGYB3IWvo7edejHe4= Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 9A97C6FC8F for ; Tue, 27 Apr 2021 00:03:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9A97C6FC8F Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1lb8OJ-0008Cy-Tu; Tue, 27 Apr 2021 00:03:40 +0300 To: Cyrill Gorcunov References: Message-ID: Date: Mon, 26 Apr 2021 23:03:39 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9ECFD8CE5F0594010E9FD8A050EF271A331F4FC8E58F6D291182A05F5380850404BFD2F05261095440BEA4F396DE56E2BD572F2425C0B7029937104F6DBFA3B8A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75037DDE13FB75316EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637802D3462438662818638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B280D48E645B2774CA0D5FBB2268B73E903999716826408816D2E47CDBA5A96583C09775C1D3CA48CF7EF884183F8E4D67117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7E688A9D963DC14319FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16BA91E23F1B6B78B78B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831EF8297C281670AF492B5ACE33AB3463B X-C1DE0DAB: 0D63561A33F958A5B6B8F964F20116BF3010F71BC4234174C0EEDBCBED19CD5BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E69981C39E7B068AA31E0254ECFD7820EDAA2E8ADAE208743EF37FC5F88CC400F63F0CF187ED12D91D7E09C32AA3244CE4FC022D2768DFEDB4DAE37D3BC902A98A6D4CC6FBFAC251FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmUj/IHfqgKcI4bmoSGBh5Q== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638223726EADC860EADD8A2EDFA84B0FF3D503841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 1/1] txn: destroy commit and rollback triggers 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" Thanks for the review! On 26.04.2021 12:13, Cyrill Gorcunov wrote: > On Sun, Apr 25, 2021 at 05:42:35PM +0200, Vladislav Shpilevoy wrote: >> static int >> txn_add_redo(struct txn *txn, struct txn_stmt *stmt, struct request *request) >> { >> @@ -149,8 +146,11 @@ txn_rollback_one_stmt(struct txn *txn, struct txn_stmt *stmt) >> { >> if (txn->engine != NULL && stmt->space != NULL) >> engine_rollback_statement(txn->engine, txn, stmt); >> - if (stmt->has_triggers) >> - txn_run_rollback_triggers(txn, &stmt->on_rollback); >> + if (stmt->has_triggers && trigger_run(&stmt->on_rollback, txn) != 0) { >> + diag_log(); >> + unreachable(); >> + panic("statement rollback trigger failed"); >> + } >> } > > Good catch, Vlad! Can we please eliminate these unreachable() calls while > you're modifying it? It is simply not needed (because it is rather a hint > for compiler and in case if the code is executing it leads to unpredicted > results so panic() is only right thing to do). Np: ==================== diff --git a/src/box/txn.c b/src/box/txn.c index 2ae55b4e1..869e43d02 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -148,7 +148,6 @@ txn_rollback_one_stmt(struct txn *txn, struct txn_stmt *stmt) engine_rollback_statement(txn->engine, txn, stmt); if (stmt->has_triggers && trigger_run(&stmt->on_rollback, txn) != 0) { diag_log(); - unreachable(); panic("statement rollback trigger failed"); } } @@ -486,7 +485,6 @@ txn_complete_fail(struct txn *txn) if (txn_has_flag(txn, TXN_HAS_TRIGGERS)) { if (trigger_run(&txn->on_rollback, txn) != 0) { diag_log(); - unreachable(); panic("transaction rollback trigger failed"); } /* Can't rollback more than once. */ @@ -514,7 +512,6 @@ txn_complete_success(struct txn *txn) */ if (trigger_run_reverse(&txn->on_commit, txn) != 0) { diag_log(); - unreachable(); panic("transaction commit trigger failed"); } /* Can't commit more than once. */