From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tml <tarantool-patches@dev.tarantool.org> Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [Tarantool-patches] [RFC v3 1/3] xrow: allow to pass timestamp via xrow_encode_vclock_timed helper Date: Fri, 30 Apr 2021 18:39:38 +0300 [thread overview] Message-ID: <20210430153940.121271-2-gorcunov@gmail.com> (raw) In-Reply-To: <20210430153940.121271-1-gorcunov@gmail.com> 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 <gorcunov@gmail.com> --- 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
next prev parent reply other threads:[~2021-04-30 15:40 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-30 15:39 [Tarantool-patches] [RFC v3 0/3] relay: provide downstream lag information Cyrill Gorcunov via Tarantool-patches 2021-04-30 15:39 ` Cyrill Gorcunov via Tarantool-patches [this message] 2021-04-30 20:45 ` [Tarantool-patches] [RFC v3 1/3] xrow: allow to pass timestamp via xrow_encode_vclock_timed helper Vladislav Shpilevoy via Tarantool-patches 2021-04-30 20:50 ` Cyrill Gorcunov via Tarantool-patches 2021-05-03 20:21 ` Konstantin Osipov via Tarantool-patches 2021-05-03 20:33 ` Cyrill Gorcunov via Tarantool-patches 2021-05-03 20:37 ` Konstantin Osipov via Tarantool-patches 2021-05-03 20:42 ` Cyrill Gorcunov via Tarantool-patches 2021-04-30 15:39 ` [Tarantool-patches] [RFC v3 2/3] applier: send first row's WAL time in the applier_writer_f Cyrill Gorcunov via Tarantool-patches 2021-04-30 20:49 ` Vladislav Shpilevoy via Tarantool-patches 2021-05-05 13:06 ` Cyrill Gorcunov via Tarantool-patches 2021-05-05 20:47 ` Vladislav Shpilevoy via Tarantool-patches 2021-05-05 22:19 ` Cyrill Gorcunov via Tarantool-patches 2021-04-30 15:39 ` [Tarantool-patches] [RFC v3 3/3] relay: provide information about downstream lag Cyrill Gorcunov via Tarantool-patches 2021-04-30 20:50 ` Vladislav Shpilevoy via Tarantool-patches 2021-04-30 20:45 ` [Tarantool-patches] [RFC v3 0/3] relay: provide downstream lag information Vladislav Shpilevoy via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210430153940.121271-2-gorcunov@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.perepelitsa@corp.mail.ru \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [RFC v3 1/3] xrow: allow to pass timestamp via xrow_encode_vclock_timed helper' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox