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 E7C436EC55; Tue, 15 Jun 2021 23:59:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E7C436EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623790768; bh=nL31Is+43E5o3H8KSUkP64eJ0C/T6nkUynt1+rhCKKQ=; 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=uS8lVtap5IT6xdnqgm/ZXACDPsORg1Gt8j/ucXCVJ7XcqQN1KHmGR9Ils5qlFOtlq y1EQv0v3PqXHkWHOWxANmsym8vNoLyWbC+RTpM7AYp6/TmeZGkguBonQWgTVV/tuxW rhmxeEAdKHz2AB6q6tdciIZ7Z+Gxc+YfBdZrMlp4= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [94.100.177.91]) (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 5DED06EC55 for ; Tue, 15 Jun 2021 23:59:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5DED06EC55 Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1ltG9e-0004lz-JC; Tue, 15 Jun 2021 23:59:26 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <2e1ee8330e3ce53517bcb489280bfa5191bb66fb.1623331925.git.sergepetrenko@tarantool.org> Message-ID: <3fa9f126-3205-ef6e-c25c-d58a26677adf@tarantool.org> Date: Tue, 15 Jun 2021 22:59:25 +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: <2e1ee8330e3ce53517bcb489280bfa5191bb66fb.1623331925.git.sergepetrenko@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54F2E6026ACF3A18D093F1E8B1F5B66022182A05F5380850400DC90E1986F6E612B79A65628D4BBD8476724F936160402BF56EE9CB1895F0DA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE776377A057133B646EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372521E7C1CE72986C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8880A7A14A6AD6A946890CB855AACEFFB117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7B96B19DC40933214DC33E588678F033D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3B355ED1E20F5346A9735652A29929C6CC4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637BBEA499411984DA1EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD5F94BE2FBACB1A8E07F653E2E21562D4 X-C1DE0DAB: 0D63561A33F958A57C00F98762AA4AF0A632B307DC45ABD690480F260C92FC99D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D4140D813EC137C65D1AEFA8B2E463D54C8BA2AFBC3768562A86686A0D7079D460895ADEC8E1B91C1D7E09C32AA3244C911C9ADB5A726AE4AF2BA34EF738A62095A9E0DC41E9A4CFFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj6OL1iHTyIM35uU/8vhYKtQ== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110DFBF29E95A9724B994C3FC2E2125E08F2A4FD9711CBF16A407784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 4/7] txn_limbo: persist the latest effective promote in snapshot 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" Danke schön für der Patch! See 3 comments below. > diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c > index 6c4982b9f..3713d39d0 100644 > --- a/src/box/memtx_engine.c > +++ b/src/box/memtx_engine.c > @@ -225,6 +226,22 @@ memtx_engine_recover_raft(const struct xrow_header *row) > return 0; > } > > +static int > +memtx_engine_recover_promote(const struct xrow_header *row) 1. Maybe call it recover_synchro instead of promote? Even in the body PROMOTE is not mentioned anyhow except for the assertion. What if we ever add more members to the synchro state? > +{ > + assert(row->type == IPROTO_PROMOTE); > + struct synchro_request req; > + if (xrow_decode_synchro(row, &req) != 0) > + return -1; > + /* > + * Origin id cannot be deduced from row.replica_id in a checkpoint, > + * because all it's rows have a zero replica_id. > + */ > + req.origin_id = req.replica_id; > + txn_limbo_process(&txn_limbo, &req); > + return 0; > +} > @@ -655,6 +676,17 @@ finish: > return rc; > } > > +static int > +checkpoint_write_promote(struct xlog *l, const struct synchro_request *req) > +{ > + struct xrow_header row; > + char body[XROW_SYNCHRO_BODY_LEN_MAX]; > + xrow_encode_synchro(&row, body, req); > + if (checkpoint_write_row(l, &row) != 0) > + return -1; > + return 0; 2. Could also make 'return checkpoint_write_row(...);' without branching + that might activate the tail call optimization. > diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h > index e409ac657..84a19bb40 100644 > --- a/src/box/txn_limbo.h > +++ b/src/box/txn_limbo.h > @@ -311,6 +311,12 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req); > int > txn_limbo_wait_confirm(struct txn_limbo *limbo); > > +/** > + * Persist limbo state to a given synchro request. > + */ > +void > +txn_limbo_checkpoint(struct txn_limbo *limbo, struct synchro_request *req); 3. Lets make the limbo a const pointer. It does not change, does it?