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 70EA06EC5F; Sun, 18 Apr 2021 11:24:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 70EA06EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618734264; bh=dkDQY/zi5Lyvq4shkQIRNNRjTEEcobWseJiLQ4TCPrU=; 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=KXUsyyDWl3BxaEZgDOipSam5o1doNzg/J2TwCwjdSfWk9IfK9nn0Nut9TxObIMMH4 xwBTxYoACVB9hq0tRddhPWrsqcSPXAZGhozKXlG3wy1REV6OFCf8/hT0Nx/Xvc/njk yisftG/yCYsbTdJRr6kdldpi26KxYXog8G6I64Kk= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 DE9826EC5F for ; Sun, 18 Apr 2021 11:24:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DE9826EC5F Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1lY2j8-0006ta-1X; Sun, 18 Apr 2021 11:24:22 +0300 To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: Date: Sun, 18 Apr 2021 11:24:21 +0300 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; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D5E28B957962BB550182A05F538085040967D0783DED491D1DAC5F7FE0868E1B3F4780391764AA1D3DE138F997C3AFE9C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745FB935E07B76C84EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377202F6F47B17DBDDEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA6587FE76D9F1085CAC044880F14947F15A2F6B57BC7E64490618DEB871D839B73339E8FC8737B5C22494854413538E1713FCC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EED76C6ED7039589DE45B9AC499A3C791CD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE31E44367C8E80A7B49735652A29929C6CC4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B2303E78B907142AC75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A23F051236DBC9DA6306C627C4D753511DAE0174B7F1092AFB3EDAD912AF36B8D9153218E4D49273A2 X-C1DE0DAB: 0D63561A33F958A5183F20C658C0BC71B9E3660FD465E5A160CFD7C4F18AE52BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3455AC8BF8E3153BA0C3CD51DFD911226C0747EE0F9764167A703AA237CB971A1DDB884A5546925A8D1D7E09C32AA3244C5B90AE17D93ACCCD80E395E975DCF7F030452B15D76AEC14FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj1t4H7vLuVFWVoiDyM7RxkA== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8A3A1C601D000FE5FDAB80EE45613D977B4934413F0E5D243424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 17.04.2021 01:12, Vladislav Shpilevoy пишет: > 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. Sure, reverted to the original version. > >> */ >> 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'. Thanks! Fixed. The incremental diff's below. > >> + */ >> +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; >> +} =========================================================== diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index 2346331c7..0d2d274f6 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -330,8 +330,8 @@ txn_limbo_write_synchro(struct txn_limbo *limbo, uint16_t type, int64_t lsn,         };         /* -        * This is a synchronous commit so we can allocate everything on a -        * stack. Note, that promote body includes synchro body. +        * This is a synchronous commit so we can +        * allocate everything on a stack.          */         char body[XROW_SYNCHRO_BODY_LEN_MAX];         struct xrow_header row; @@ -483,8 +483,8 @@ txn_limbo_write_promote(struct txn_limbo *limbo, int64_t lsn, uint64_t term)  }  /** - * Process a PROMOTE request, i.e. confirm all entries <= @req.lsn and rollback all - * entries > @req.lsn. + * Process a PROMOTE request, i.e. confirm all entries <= @a req.lsn and + * rollback all entries > @a req.lsn.   */  static void  txn_limbo_read_promote(struct txn_limbo *limbo, -- Serge Petrenko