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 61E9C6FC8F; Fri, 16 Apr 2021 19:26:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 61E9C6FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618590379; bh=WrGogN+XSV3ksPnE6t+pX04fRX5T6Zmt7pQ7SCJM9F8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=C+L3unp0j5A8m0UOnvWEASjmqfNMCkrhMcACVbUgjiMip+9r34fLhsGHhwOE21HqQ UXNisE5hkxw73UKEBJGNItrHB88t2t6t9XghPrMyYf7dQaGJXbuG2ubL/HiOpnkD6I XAZL0Wy7Y7ERwC3ZrAI0U5V52zsiBFvDhJvldyg4= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (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 0B44C6FC8F for ; Fri, 16 Apr 2021 19:25:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0B44C6FC8F Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1lXRHv-00008e-7B; Fri, 16 Apr 2021 19:25:47 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Fri, 16 Apr 2021 19:25:32 +0300 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480D608FE24BC85426BB1B55F651FED8C70182A05F538085040B5C19F6A4EE674ACFFB095137812EF04C9B1AA643221CC6D9C5CEEAAF7917F37 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79488F21A45FBCE3EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637817108B649554FEC8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B27EC42E70B03DBE8D2B80921E4817154085184F9B92705903D2E47CDBA5A96583C09775C1D3CA48CF253F27DA5A70FAF3117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE79FEEBCD9E13F050E9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7B2906EECA3A8A570D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0C3C079A8C1BF321ACD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3CE9959E2676FD87735872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C978319E095788079326520C4CD27AEC68174C X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CBF1196BB3248DD4B69CEB2FF16E1A5D15307001DFE4FA86B9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344B4608D01B1CB59A6B120AE248B71F26232D29EE267203571C87B2B9F80B45CB65E5BE6F31DC908E1D7E09C32AA3244C0E9F34CA80620984C7BCA282A7EE62A5795D98D676DD64D0927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj3S6P1v0GIqSkHVoaZdgzzA== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F88BD3238A7C90767283C4FEB09A18DBDF36799F91EFF50B36424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 01/12] wal: make wal_assign_lsn accept journal entry 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- src/box/wal.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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); -- 2.24.3 (Apple Git-128)