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 B05516FC8F; Fri, 16 Apr 2021 10:11:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B05516FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618557081; bh=bhQk7FU0ceVWSiUwFXU+iyee2mZodb3n8ArpiHIi5rQ=; 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=O/WRSvarsulx1EkDuJ8u4M/DBym9FNyc+w09rh4TPc8pWS+LnrWYGZz7uWmQzBL+O dStnJTxD1mkvY3PYzRZW55U0AF5BBY6KIZGlATUOHTCl0p4hmQu0eWl0IbMWfwsK1Z xL5adLAOdlcH14iId7pfcXMln7BHOOGk0Z9mbPFU= Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 78B396FC8F for ; Fri, 16 Apr 2021 10:11:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 78B396FC8F Received: by smtp16.mail.ru with esmtpa (envelope-from ) id 1lXIdL-0002xP-PN; Fri, 16 Apr 2021 10:11:20 +0300 To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <32099031-d261-5887-538a-86d770a15617@tarantool.org> <75ca15d4-9614-12e3-6871-10f36831a78a@tarantool.org> Message-ID: Date: Fri, 16 Apr 2021 10:11:19 +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: <75ca15d4-9614-12e3-6871-10f36831a78a@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979723F2FB4628545A35182A05F5380850400CFE14544F26CECDCE70772D41026C085861EA44C6050A5A2DFF628D8301D0FD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CE54A8686262D0D1EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377A079619B0C2EE308638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B27DE31B24AA7F69F501A2E729146F79D9CCD65611471A2689D2E47CDBA5A96583C09775C1D3CA48CF27ED053E960B195E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE78C592797616C97AB9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7AF84514071B8F87AD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0E3E3FB6EC827F0A0CD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3C9EEE74C166EF7BC35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C978310B2EF132CA3BEB8211447ED96C72CD2D X-C1DE0DAB: 0D63561A33F958A5810179BCE9BF3526F8A7F76CAFF4AAEFEEF2968CB4BCD4CBD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346B71C4B0698719D7E55358673892FF4BA3207CB249A7D6AABFFD3EB6FA8B15438B875E14005EE6741D7E09C32AA3244C180D2ADC0502E91FE8CD41894743FE9769B6CAE0477E908DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj3S6P1v0GIqQGEBvDmoISOg== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8CC94EDE1B50C6AC2A629E8BD34B33BB5713339563F79FCDB424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3 01/10] wal: enrich row's meta information with sync replication flags 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" 16.04.2021 10:08, Serge Petrenko via Tarantool-patches пишет: > > > 16.04.2021 02:18, Vladislav Shpilevoy пишет: > >> >>>   } >>>     /** >>> diff --git a/src/box/wal.c b/src/box/wal.c >>> index 34af0bda6..4ec8034a3 100644 >>> --- a/src/box/wal.c >>> +++ b/src/box/wal.c >>> @@ -962,14 +962,14 @@ out: >>>    */ >>>   static void >>>   wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base, >>> -           struct xrow_header **row, >>> -           struct xrow_header **end) >>> +           struct journal_entry *entry) >> 3. This part could be a separate commit, otherwise it is hard to >> see the functional changes. Up to you if you want to split. > > Good idea, let's do that. > > Incremental diff for this commit is below and the extracted commit > regarding wal_assign_lsn() refactoring is in reply to this email. > ================================================================ commit d5c2ea43f89afb2e9507f14d4ad651955cee2803 Author: Serge Petrenko Date:   Fri Apr 16 09:58:09 2021 +0300     wal: make wal_assign_lsn accept journal entry     Refactor wal_assign_lsn() to accept a journal entry instead of a pair of     pointers to the first and last entry rows.     Journal entry will carry additional meta information for the last row     soon, which will be needed in wal_assign_lsn().     Prerequisite #5445 diff --git a/src/box/wal.c b/src/box/wal.c index 34af0bda6..95ee8e200 100644 --- a/src/box/wal.c +++ b/src/box/wal.c @@ -962,14 +962,14 @@ out:   */  static void  wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base, -           struct xrow_header **row, -           struct xrow_header **end) +           struct journal_entry *entry)  {      int64_t tsn = 0; -    struct xrow_header **start = row; -    struct xrow_header **first_glob_row = row; +    struct xrow_header **start = entry->rows; +    struct xrow_header **end = entry->rows + entry->n_rows; +    struct xrow_header **first_glob_row = entry->rows;      /** Assign LSN to all local rows. */ -    for ( ; row < end; row++) { +    for (struct xrow_header **row = start; row < end; row++) {          if ((*row)->replica_id == 0) {              /*               * All rows representing local space data @@ -1020,7 +1020,7 @@ wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base,       * the first global row. tsn was yet unknown when those       * rows were processed.       */ -    for (row = start; row < first_glob_row; row++) +    for (struct xrow_header **row = start; row < first_glob_row; row++)          (*row)->tsn = tsn;  } @@ -1098,8 +1098,7 @@ wal_write_to_disk(struct cmsg *msg)      struct journal_entry *entry;      struct stailq_entry *last_committed = NULL;      stailq_foreach_entry(entry, &wal_msg->commit, fifo) { -        wal_assign_lsn(&vclock_diff, &writer->vclock, -                   entry->rows, entry->rows + entry->n_rows); +        wal_assign_lsn(&vclock_diff, &writer->vclock, entry);          entry->res = vclock_sum(&vclock_diff) +                   vclock_sum(&writer->vclock);          rc = xlog_write_entry(l, entry); @@ -1319,8 +1318,7 @@ wal_write_none_async(struct journal *journal,      struct vclock vclock_diff;      vclock_create(&vclock_diff); -    wal_assign_lsn(&vclock_diff, &writer->vclock, entry->rows, -               entry->rows + entry->n_rows); +    wal_assign_lsn(&vclock_diff, &writer->vclock, entry);      vclock_merge(&writer->vclock, &vclock_diff);      vclock_copy(&replicaset.vclock, &writer->vclock);      entry->res = vclock_sum(&writer->vclock); -- Serge Petrenko