From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C80264696C3 for ; Mon, 6 Apr 2020 11:39:05 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id f20so13752725ljm.0 for ; Mon, 06 Apr 2020 01:39:05 -0700 (PDT) Date: Mon, 6 Apr 2020 11:39:04 +0300 From: Konstantin Osipov Message-ID: <20200406083904.GB12472@atlas> References: <3162d52a68b95a43a0756dd2e03e4418dd80eafa.1585565637.git.sergepetrenko@tarantool.org> <0f687ed6-2a15-6b1b-1c6e-f98814f9e162@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f687ed6-2a15-6b1b-1c6e-f98814f9e162@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v5 1/4] vclock: add an ability to reset individual clock components List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org * Vladislav Shpilevoy [20/04/05 05:06]: > > +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? It's historical. I also suggest the function should be inlined and optimized into callers. > > > +{ > > + 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; > > +} -- Konstantin Osipov, Moscow, Russia