Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Konstantin Osipov <kostja.osipov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v3 1/4] vclock: add an ability to set individual clock components
Date: Fri, 27 Mar 2020 13:22:58 +0300	[thread overview]
Message-ID: <71B97126-6C1A-40D0-8484-EF075416328E@tarantool.org> (raw)
In-Reply-To: <20200323163723.GB5491@atlas>


> 23 марта 2020 г., в 19:37, Konstantin Osipov <kostja.osipov@gmail.com> написал(а):
> 
> * Serge Petrenko <sergepetrenko@tarantool.org> [20/03/23 19:23]:
>> This is needed to 'hide' 0-th vclock component in replication responses.
> 
> I think the name should reflect the magic that happens in this
> function.
> 
> How about vclock_reset()?

No problem, fixed.

> 
>> 
>> Follow-up #3186
>> Prerequisite #4114
>> ---
>> src/box/vclock.c | 15 +++++++++++++++
>> src/box/vclock.h | 11 +++++++++++
>> 2 files changed, 26 insertions(+)
>> 
>> diff --git a/src/box/vclock.c b/src/box/vclock.c
>> index 90ae27591..302c0438d 100644
>> --- a/src/box/vclock.c
>> +++ b/src/box/vclock.c
>> @@ -37,6 +37,21 @@
>> #include "diag.h"
>> #include "tt_static.h"
>> 
>> +void
>> +vclock_set(struct vclock *vclock, uint32_t replica_id, int64_t lsn)
>> +{
>> +	assert(lsn >= 0);
>> +	assert(replica_id < VCLOCK_MAX);
>> +	vclock->signature -= vclock_get(vclock, replica_id);
>> +	if (lsn == 0) {
>> +		vclock->map &= ~(1 << replica_id);
>> +		return;
>> +	}
> 
>> +	vclock->lsn[replica_id] = lsn;
>> +	vclock->map |= 1 << replica_id;
>> +	vclock->signature += lsn;
>> +}
>> +
>> int64_t
>> vclock_follow(struct vclock *vclock, uint32_t replica_id, int64_t lsn)
>> {
>> diff --git a/src/box/vclock.h b/src/box/vclock.h
>> index 79e5a1bc0..7dc69015f 100644
>> --- a/src/box/vclock.h
>> +++ b/src/box/vclock.h
>> @@ -211,6 +211,17 @@ vclock_calc_sum(const struct vclock *vclock)
>> 	return sum;
>> }
>> 
>> +/**
>> + * Set vclock component represented by replica id to the desired
>> + * value.
> 
> Why is it necessary and how is it used? Should be in this comment. 
> The use case is still not very clear from the commit comment.
> 

I amended both the commit message and the comment. Please see v4

>> + *
>> + * @param vclock Vector clock.
>> + * @param replica_id Replica identifier.
>> + * @param lsn Lsn to set
>> + */
>> +void
>> +vclock_set(struct vclock *vclock, uint32_t replica_id, int64_t lsn);
>> +
>> static inline int64_t
>> vclock_sum(const struct vclock *vclock)
> 
> -- 
> Konstantin Osipov, Moscow, Russia
> https://scylladb.com


--
Serge Petrenko
sergepetrenko@tarantool.org

  reply	other threads:[~2020-03-27 10:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 16:19 [Tarantool-patches] [PATCH v3 0/4] replication: fix local space tracking Serge Petrenko
2020-03-23 16:19 ` [Tarantool-patches] [PATCH v3 1/4] vclock: add an ability to set individual clock components Serge Petrenko
2020-03-23 16:37   ` Konstantin Osipov
2020-03-27 10:22     ` Serge Petrenko [this message]
2020-03-23 16:19 ` [Tarantool-patches] [PATCH v3 2/4] gc: rely on minimal vclock components instead of signatures Serge Petrenko
2020-03-23 16:40   ` Konstantin Osipov
2020-03-27 10:24     ` Serge Petrenko
2020-03-23 16:19 ` [Tarantool-patches] [PATCH v3 3/4] replication: hide 0-th vclock components in replication responses Serge Petrenko
2020-03-23 16:42   ` Konstantin Osipov
2020-03-23 16:19 ` [Tarantool-patches] [PATCH v3 4/4] box: start counting local space requests separately Serge Petrenko
2020-03-23 16:51   ` Konstantin Osipov
2020-03-27 10:40     ` Serge Petrenko
2020-03-28 16:20       ` Konstantin Osipov

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=71B97126-6C1A-40D0-8484-EF075416328E@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=kostja.osipov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 1/4] vclock: add an ability to set individual clock components' \
    /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