Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Georgy Kirichenko <georgy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH v2 2/2] Track wal vclock changes instead of copying
Date: Thu, 14 Feb 2019 17:04:54 +0300	[thread overview]
Message-ID: <20190214140453.axpxyjygdldbubcn@esperanza> (raw)
In-Reply-To: <9b0d551519dd24f3c456fc28e512e26e953275fc.1550046797.git.georgy@tarantool.org>

On Wed, Feb 13, 2019 at 11:35:17AM +0300, Georgy Kirichenko wrote:
> +/*
> + * Assign lsn and replica identifier for local writes and track
> + * row into vclock_diff.
> + */
>  static void
> -wal_assign_lsn(struct vclock *vclock, struct xrow_header **row,
> +wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base,
> +	       struct xrow_header **row,
>  	       struct xrow_header **end)
>  {
>  	/** Assign LSN to all local rows. */
>  	for ( ; row < end; row++) {
>  		if ((*row)->replica_id == 0) {
> -			(*row)->lsn = vclock_inc(vclock, instance_id);
> +			(*row)->lsn = vclock_inc(vclock_diff, instance_id) +
> +				      vclock_get(base, instance_id);
>  			(*row)->replica_id = instance_id;
>  		} else {
> -			vclock_follow_xrow(vclock, *row);
> +			vclock_follow(vclock_diff, (*row)->replica_id,
> +				      (*row)->lsn - vclock_get(base,
> +							       (*row)->replica_id));

vclock_follow_xrow() checks that LSN doesn't go backwards and panics if
it does.

vclock_follow() doesn't have such check.

  parent reply	other threads:[~2019-02-14 14:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  8:35 [tarantool-patches] [PATCH v2 0/2] Reduce wal vclock handling complecity Georgy Kirichenko
2019-02-13  8:35 ` [tarantool-patches] [PATCH v2 1/2] Lightweight vclock_create and vclock_copy Georgy Kirichenko
2019-02-14 10:26   ` [tarantool-patches] " Konstantin Osipov
2019-02-13  8:35 ` [tarantool-patches] [PATCH v2 2/2] Track wal vclock changes instead of copying Georgy Kirichenko
2019-02-14 10:31   ` [tarantool-patches] " Konstantin Osipov
2019-02-14 14:04   ` Vladimir Davydov [this message]
2019-02-14 14:42 ` [tarantool-patches] [PATCH v2 0/2] Reduce wal vclock handling complecity Vladimir Davydov

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=20190214140453.axpxyjygdldbubcn@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v2 2/2] Track wal vclock changes instead of copying' \
    /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