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 021406B962; Wed, 14 Apr 2021 12:13:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 021406B962 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618391605; bh=IeoxY7T3vZMidI8q9krS3d97d/LLKcobJadnRXbvFO0=; 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=kG68n4BxOV3m4xLEThYkfUvZmW8ndh+djuwF+MwUTTr+jB/vNeMUYikt4iZJPz40C i52k5OsmF1H5D+y2WoTgmyqeRMk7e7h363aSN0rYaSM1li9Kdb0NIWv7l5mIOe3oKl k8yVSvmvogq7K+kAWyY8jLTJ2mSZM/qS76x6nwT4= Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (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 C01A46BD23 for ; Wed, 14 Apr 2021 12:12:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C01A46BD23 Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1lWbZv-0007gt-26; Wed, 14 Apr 2021 12:12:55 +0300 To: Cyrill Gorcunov Cc: v.shpilevoy@tarantool.org, tarantool-patches@dev.tarantool.org References: <150875bcbaaa0b7c270c1d53dc623892312fe16d.1618256019.git.sergepetrenko@tarantool.org> Message-ID: Date: Wed, 14 Apr 2021 12:12:54 +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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480D608FE24BC85426BB1B55F651FED8C70182A05F538085040FC99E1922972DEDC92A7D7C94D1DCDA268BC53249672B0D1A56AAEFB90C1F855 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78887611F2F2455C9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D08ED87D5614270A8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B21F95E527468B659FD0E7AA0C0AEC440F6FD1C55BDD38FC3FD2E47CDBA5A96583C09775C1D3CA48CF27ED053E960B195E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7820CF4CC0E318EFB9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE794F92387495FED0AD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0044B9F2C9FBC7C0DCD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3C9EEE74C166EF7BC35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C9783118600101B6F8B73799F3B6BFDA6AA5C4 X-C1DE0DAB: 0D63561A33F958A58A1EF532F2652ACA5679424127956D361C22157F3F5E3ADDD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34ADE558D2B396DA7CBDD0BE1FBA6B89A4D2CA3DD7BF36914C6D6B8765BACCEDDE0474A64845D585B31D7E09C32AA3244C804EA537F59A150566952176B3CEFAA1CE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXEbtSFLbWtgxg== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8D15F61E8DFEC9F17DF39D207771960A9DB6346839D2957A6424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 4/9] 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" 13.04.2021 17:33, Cyrill Gorcunov пишет: > On Mon, Apr 12, 2021 at 10:40:17PM +0300, Serge Petrenko wrote: >> } else { >> - txn_limbo_force_empty(&txn_limbo, wait_lsn); >> + /* >> + * Term parameter is unused now, We'll pass >> + * box_raft()->term there later. >> + */ >> + txn_limbo_write_promote(&txn_limbo, wait_lsn, 0); >> + struct synchro_request req = { >> + .type = 0, /* unused */ >> + .replica_id = 0, /* unused */ >> + .origin_id = instance_id, >> + .lsn = wait_lsn, >> + .term = 0, /* unused */ >> + }; > Is there some particular meaning of zeroifying designated assignments? > I mean why not simply > > struct synchro_request req = { > .origin_id = instance_id, > .lsn = wait_lsn, > }; > > or you wanted to pay attention that the left of the fields are > unused? Just curious, I'm fine with current code. A diff as per changes requested in patch 2. ====================================================== diff --git a/src/box/applier.cc b/src/box/applier.cc index e8cbbe27a..65a749b62 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -822,12 +822,15 @@ synchro_entry_new(struct xrow_header *applier_row,         }         struct journal_entry *journal_entry = &entry->journal_entry; -       struct synchro_body_bin *body_bin = &entry->body_bin.base;         struct xrow_header *row = &entry->row;         journal_entry->rows[0] = row; -       xrow_encode_synchro(row, body_bin, req); +       assert(iproto_type_is_synchro_request(req->type)); +       if (iproto_type_is_promote_request(req->type)) +               xrow_encode_promote(row, &entry->body_bin, req); +       else +               xrow_encode_synchro(row, &entry->body_bin.base, req);         row->lsn = applier_row->lsn;         row->replica_id = applier_row->replica_id; diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index f119c35b6..36c233348 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -333,8 +333,7 @@ txn_limbo_write_synchro(struct txn_limbo *limbo, uint32_t type, int64_t lsn,          * This is a synchronous commit so we can allocate everything on a          * stack. Promote body includes synchro body.          */ -       struct promote_body_bin body; -       struct synchro_body_bin *base = &body.base; +       struct promote_body_bin body_bin;         struct xrow_header row;         char buf[sizeof(struct journal_entry) + @@ -343,7 +342,10 @@ txn_limbo_write_synchro(struct txn_limbo *limbo, uint32_t type, int64_t lsn,         struct journal_entry *entry = (struct journal_entry *)buf;         entry->rows[0] = &row; -       xrow_encode_synchro(&row, base, &req); +       if (type == IPROTO_PROMOTE) +               xrow_encode_promote(&row, &body_bin, &req); +       else +               xrow_encode_synchro(&row, &body_bin.base, &req);         journal_entry_create(entry, 1, xrow_approx_len(&row),                              txn_limbo_write_cb, fiber()); -- Serge Petrenko