From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tml <tarantool-patches@dev.tarantool.org> Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [Tarantool-patches] [PATCH v2 1/3] applier: encode timestamp into vclock message Date: Mon, 1 Feb 2021 13:00:35 +0300 [thread overview] Message-ID: <20210201100037.212301-2-gorcunov@gmail.com> (raw) In-Reply-To: <20210201100037.212301-1-gorcunov@gmail.com> The vclock message sent by "applierw" fiber to the replication master node operates not only for tracking status of applied data but also as a heartbeat packets (after 1.7.7). To track downstream node lag we can put realtime value here. This won't break any existing instances without the patch because the field is unused anywhere yet. Part-of #5447 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> --- src/box/applier.cc | 3 ++- src/box/xrow.c | 5 ++++- src/box/xrow.h | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/box/applier.cc b/src/box/applier.cc index 553db76fc..a418edef0 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -183,7 +183,8 @@ applier_writer_f(va_list ap) try { applier->has_acks_to_send = false; struct xrow_header xrow; - xrow_encode_vclock(&xrow, &replicaset.vclock); + xrow_encode_vclock_timed(&xrow, &replicaset.vclock, + ev_now(loop())); coio_write_xrow(&io, &xrow); ERROR_INJECT(ERRINJ_APPLIER_SLOW_ACK, { fiber_sleep(0.01); diff --git a/src/box/xrow.c b/src/box/xrow.c index bc06738ad..b7b522820 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -1629,7 +1629,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)); @@ -1648,6 +1650,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 fde8f9474..8b91a3241 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -478,6 +478,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. @@ -486,8 +500,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.29.2
next prev parent reply other threads:[~2021-02-01 10:01 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-01 10:00 [Tarantool-patches] [PATCH v2 0/3] box/info: report replication.X.downstream.lag Cyrill Gorcunov via Tarantool-patches 2021-02-01 10:00 ` Cyrill Gorcunov via Tarantool-patches [this message] 2021-02-01 10:00 ` [Tarantool-patches] [PATCH v2 2/3] box/info: report replication.X.downstream.lag value Cyrill Gorcunov via Tarantool-patches 2021-02-04 13:28 ` Serge Petrenko via Tarantool-patches 2021-02-01 10:00 ` [Tarantool-patches] [PATCH v2 3/3] test: replication/status -- fetch downstream lag field Cyrill Gorcunov 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=20210201100037.212301-2-gorcunov@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 1/3] applier: encode timestamp into vclock message' \ /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