[Tarantool-patches] [PATCH v5 1/4] vclock: add an ability to reset individual clock components

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Apr 4 23:51:53 MSK 2020


Thanks for the patch!

On 30/03/2020 13:04, Serge Petrenko wrote:
> Anonymous replicas use 0th vclock component to sign local rows.
> vclock_reset will allow to zero-out 0th vclock component when an
> anonymous replica is promoted to a normal one and sends out its vclock
> to other joining instances, as to not pollute their own 0th vclock
> component.
> Also add a shortcut for vclcok_copy() + vclock_reset() for 0th clock
> component: vclock_copy_ignore0()
> 
> Follow-up #3186
> Prerequisite #4114
> ---
>  src/box/vclock.c | 15 +++++++++++++++
>  src/box/vclock.h | 24 ++++++++++++++++++++++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/src/box/vclock.c b/src/box/vclock.c
> index 90ae27591..ac3e9fccd 100644
> --- a/src/box/vclock.c
> +++ b/src/box/vclock.c
> @@ -37,6 +37,21 @@
>  #include "diag.h"
>  #include "tt_static.h"
>  
> +void
> +vclock_reset(struct vclock *vclock, uint32_t replica_id, int64_t lsn)

This is probably already discussed, but why do we have general
reset for arbitrary replica_id+lsn, and yet we have specialized
copy_ignore0? Why this function was not called vclock_reset0() with
replica_id == 0 and lsn == 0 always?

> +{
> +	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;
> +}


More information about the Tarantool-patches mailing list