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 99ED36EC5F; Fri, 30 Apr 2021 18:40:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 99ED36EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1619797217; bh=FH+Wd1kPiC5/mz0LEOOB+3UdTEU9C2kzHTwR9Q2tzIk=; 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=m11ART9lKJI8zBiC/7rk/V+fW/BX1h9TtFF7LpDtkRt3y8X83Om2MLIBA2lPA8fFc TMkPpd+lx+p2HMRawDqBM0+Ut2TnRzzXdUZJcv96i+WBN2UHmuqCHk21dH4NGLdYj/ Jv0QKcilDJ3WpGmiziHuOnQOcp6uOFasBM8+vm/k= Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5D6486EC5F for ; Fri, 30 Apr 2021 18:39:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D6486EC5F Received: by mail-lj1-f176.google.com with SMTP id o16so81317157ljp.3 for ; Fri, 30 Apr 2021 08:39:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S6GNR8CXKVkiz96QQ2wwZaTu9tP9bx3tQiQJPcahWP0=; b=BWNH1+VYVgOhmRmQw24tsSRmqGBuGY8r2HitMDC7NthmkYdz3QjEJyK7Nzz98ryjOc kn6nBl9vbgJ32izS8Md/Qg0UAqPnySHm8VKsS+WyxmoZGZPtOowwcOsJOQ5t4c2kgZ8z zND5li6Itqy8W9C7ZgO4JMWZYwVTRwk6DHiahidTeYC8V+cCtV1OkJf9vHxyp1Hf4Yc+ LoWNAKefMcHT+1KRxh7uJkupPj+tSdz0qJGdxQJII7Q1tq45PlAeOWa2mHW08js8Jj9n Ku6n7AvSoNxj5esvRZ/I6PDqhL6uiBWQ1T5wcjONQfHqn2BQa/J6pri2Q5WzFW2BI/vM dFEw== X-Gm-Message-State: AOAM531kuiRph359LL4/Nc5arsiRZmAqwm4+kB4W+zdBM1Rgts84xgLQ Nlkoz5VMQwYSy18dOj4lsaDW94zPK4Q= X-Google-Smtp-Source: ABdhPJzw3dfUOrm6pNNQCjRz3clORBNRpoFQrtnBnc5p8mSfmN/H0GgKe2Sbla6YfHQERvm4HRF7Jg== X-Received: by 2002:a2e:7010:: with SMTP id l16mr4298507ljc.41.1619797196017; Fri, 30 Apr 2021 08:39:56 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id r26sm284048ljg.3.2021.04.30.08.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 08:39:55 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 70F09560066; Fri, 30 Apr 2021 18:39:41 +0300 (MSK) To: tml Date: Fri, 30 Apr 2021 18:39:38 +0300 Message-Id: <20210430153940.121271-2-gorcunov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210430153940.121271-1-gorcunov@gmail.com> References: <20210430153940.121271-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [RFC v3 1/3] xrow: allow to pass timestamp via xrow_encode_vclock_timed helper 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Mons Anderson , Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" We will enhance applier writer with timestamp of last written row. It is needed to detect downstream lag. Part-of #5447 Signed-off-by: Cyrill Gorcunov --- src/box/xrow.c | 5 ++++- src/box/xrow.h | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/box/xrow.c b/src/box/xrow.c index 2e364cea5..46ae23a78 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -1643,7 +1643,9 @@ xrow_encode_join(struct xrow_header *row, const struct tt_uuid *instance_uuid) } int -xrow_encode_vclock(struct xrow_header *row, const struct vclock *vclock) +xrow_encode_vclock_timed(struct xrow_header *row, + const struct vclock *vclock, + double tm) { memset(row, 0, sizeof(*row)); @@ -1662,6 +1664,7 @@ xrow_encode_vclock(struct xrow_header *row, const struct vclock *vclock) row->body[0].iov_base = buf; row->body[0].iov_len = (data - buf); row->bodycnt = 1; + row->tm = tm; row->type = IPROTO_OK; return 0; } diff --git a/src/box/xrow.h b/src/box/xrow.h index b3c664be2..f48e64b83 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -495,6 +495,20 @@ xrow_decode_register(struct xrow_header *row, struct tt_uuid *instance_uuid, NULL, NULL); } +/** + * Encode vector clock with timestamp. + * @param row[out] Row to encode into. + * @param vclock vector clock to encode. + * @param tm timestamp. + * + * @retval 0 Success. + * @retval -1 Memory error. + */ +int +xrow_encode_vclock_timed(struct xrow_header *row, + const struct vclock *vclock, + double tm); + /** * Encode end of stream command (a response to JOIN command). * @param row[out] Row to encode into. @@ -503,8 +517,11 @@ xrow_decode_register(struct xrow_header *row, struct tt_uuid *instance_uuid, * @retval 0 Success. * @retval -1 Memory error. */ -int -xrow_encode_vclock(struct xrow_header *row, const struct vclock *vclock); +static inline int +xrow_encode_vclock(struct xrow_header *row, const struct vclock *vclock) +{ + return xrow_encode_vclock_timed(row, vclock, 0); +} /** * Decode end of stream command (a response to JOIN command). -- 2.30.2