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 91D306EC5F; Sat, 17 Apr 2021 01:12:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 91D306EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618611167; bh=wegfrN/8TNgos7KQG9jpogFtR6ldFaOSkOhhj52Uv3o=; 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=FAMuPDsLchRtyq5m1ibw8xi/S5PSJS1Y8v7qxHb29osUr6Ovcay3r0HMOoghWBdk7 2ADj+C78aN4OiJiWEaMs+ovmE6e/Fd5dMOLaI+cOVWHvEUkqEamaSuz99S75VaV+GC YQj9lw+ee34n+TSezToH+fyOBuSY0lajG2bg+qz8= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 81DFA6EC5F for ; Sat, 17 Apr 2021 01:12:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 81DFA6EC5F Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1lXWhe-0001VX-OG; Sat, 17 Apr 2021 01:12:43 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: Date: Sat, 17 Apr 2021 00:12:41 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 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: 4F1203BC0FB41BD92FFCB8E6708E7480BE79914FF86F9151AC38CC435EA4A654182A05F538085040FF9C5041BAE07D29007D52F3FC0156CB30158A6EA887CBF7A1064A3882408BAD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76C33606E6E3377E0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063795CC1D0E17AABBAA8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B22D29E1EFADB1704719120A67A563B40498738A72DB41484ED2E47CDBA5A96583C09775C1D3CA48CFCF36E64A7E3F8E58117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE79AE9BAF3542BD4619FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE752A5EEF8A95EFF99D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0A9539A8B24243104B3661434B16C20AC78D18283394535A9E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADC9C490B0B7E26B463C005E19CD1D830C X-C1DE0DAB: 0D63561A33F958A503FB02D12B19C95691769A94DE0F24E30225D71ADA9B89BAD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A503FBFE8BE8FC49A6E2C4E3138B402F5D7BB9113BAF7F817ACC7C897B9F927C6D69F30DF1C0D2381D7E09C32AA3244C2C4CF5EBB781393154221DD26ED7DAE830363D8B7DA7DD44FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojr8JA+pXcDul3YrQjbHSNFg== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110545A5A76F047CCFA34DB45FE1ED4352A8EBC351F00F9D2C107784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 05/12] box: make clear_synchro_queue() write a PROMOTE entry instead of CONFIRM + ROLLBACK 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" Good job on the patch! See 2 comments below. > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index c96e497c6..2346331c7 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c > @@ -317,19 +317,21 @@ txn_limbo_write_cb(struct journal_entry *entry) > } > > static void > -txn_limbo_write_synchro(struct txn_limbo *limbo, uint16_t type, int64_t lsn) > +txn_limbo_write_synchro(struct txn_limbo *limbo, uint16_t type, int64_t lsn, > + uint64_t term) > { > - assert(lsn > 0); > + assert(lsn >= 0); > > struct synchro_request req = { > .type = type, > .replica_id = limbo->owner_id, > .lsn = lsn, > + .term = term, > }; > > /* > - * This is a synchronous commit so we can > - * allocate everything on a stack. > + * This is a synchronous commit so we can allocate everything on a > + * stack. Note, that promote body includes synchro body. 1. I think this might be discarded now. They have the same encoder in this version. Up to you. > */ > char body[XROW_SYNCHRO_BODY_LEN_MAX]; > struct xrow_header row; > @@ -464,6 +466,37 @@ txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn) > box_update_ro_summary(); > } > > +void > +txn_limbo_write_promote(struct txn_limbo *limbo, int64_t lsn, uint64_t term) > +{ > + limbo->confirmed_lsn = lsn; > + limbo->is_in_rollback = true; > + /* > + * We make sure that promote is only written once everything this > + * instance has may be confirmed. > + */ > + struct txn_limbo_entry *e = txn_limbo_last_synchro_entry(limbo); > + assert(e == NULL || e->lsn <= lsn); > + (void) e; > + txn_limbo_write_synchro(limbo, IPROTO_PROMOTE, lsn, term); > + limbo->is_in_rollback = false; > +} > + > +/** > + * Process a PROMOTE request, i.e. confirm all entries <= @req.lsn and rollback all > + * entries > @req.lsn. 2. For referencing parameters in doxygen style you need to use '@a '. So it would be '@a req.lsn'. > + */ > +static void > +txn_limbo_read_promote(struct txn_limbo *limbo, > + const struct synchro_request *req) > +{ > + txn_limbo_read_confirm(limbo, req->lsn); > + txn_limbo_read_rollback(limbo, req->lsn + 1); > + assert(txn_limbo_is_empty(&txn_limbo)); > + limbo->owner_id = req->origin_id; > + limbo->confirmed_lsn = 0; > +}