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 504C16EC55; Mon, 12 Jul 2021 11:03:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 504C16EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626077015; bh=hDv7pIR4tJ2qUw8/73xkyhkQSFLiOSDX2d2m96kvYp8=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=dtUaEbw+cbZIYzeXL1e/sFD0j+Z+2bdJLvV2Wio/0t5mtauUVlLln9wyZCuKES6hx dnVfOo5p2RRVmXNYUH6u8GxKuJDomxlZwMBfjqXVHtD6Ec8LZSFTAPeHSwbGT3ag5V kylxpHbxRFfJYO0hkX/ZbjVt9zGF96zU7NQWW4RU= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [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 3F1656EC55 for ; Mon, 12 Jul 2021 11:03:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3F1656EC55 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1m2qub-0001rh-L2; Mon, 12 Jul 2021 11:03:34 +0300 To: Cyrill Gorcunov Cc: tml References: <20210710222803.253251-1-gorcunov@gmail.com> Message-ID: <4965b115-dd42-0129-0086-a0ff711fa648@tarantool.org> Date: Mon, 12 Jul 2021 10:03:32 +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-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB1FB1A3F86EB146194530BD4386868AAF182A05F538085040C3C462C18D945487CE728207F99A3A5DC80C3E2408C77FF454DBDF48197C89B2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79FF7180C05A1FF7CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637651D61939D0B3DD78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8FA5D3089055E0050721D045218E8DDAC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC587F3D2152687E5CA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FE5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A45692FFBBD75A6A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A52CB13CA346ECE66EAA9DB63DEF926A2B04220934AA799536D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753753CEE10E4ED4A7410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A2EC120135420F901775A6D6F87754CA96BBA4839CBF318D8865CC84391CAC1672A93B2F28AD80F91D7E09C32AA3244C7594DCD46543AD25F00A7CFD50A914B997FE24653F78E668729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj/3sbGI30XhcL8EJTQSC49g== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D2A80204F930FC5329D385E30A20C54AA3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] limbo: introduce request processing hooks 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" >> This simply should not be possible. The term map is updated only >> after WAL write is done. At least this is how it works now, doesn't >> it? Why did you change it? (In case you did, because I am not sure, >> I didn't review the code throughly). > > Look, I think this maybe not explicitly seen from the patch since > diff is big enough. But here is a key moment. Current code is called > after WAL is updated > > void > txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) > { > uint64_t term = req->term; > uint32_t origin = req->origin_id; > if (txn_limbo_replica_term(limbo, origin) < term) { > vclock_follow(&limbo->promote_term_map, origin, term); > if (term > limbo->promote_greatest_term) { > limbo->promote_greatest_term = term; > } else if (req->type == IPROTO_PROMOTE) { > /* > * PROMOTE for outdated term. Ignore. > */ > --> return; > } > } > > we exit early without any error. > > In new approach we start reporting an error if this situation is > happening, 'cause it is a split brain. But we shall not write this > term into our WAL file, thus we should validate incoming packet > earlier. > > Now imagine the following: we validated the incoming packet and > remember its term in promote_term_map, then we start writting > this packet into our WAL and write procedure failed. That is the core problem of your entire approach - why do you imagine we update promote_term_map before writing to WAL? We do not do that. And you should not do that. Before WAL write there should no be any changes. **Zero changes before WAL write**. Before you write to WAL, you can only validate requests. Using `const struct txn_limbo *`. With zero changes.