Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Serge Petrenko <sergepetrenko@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v2 2/3] cfg: support symbolic evaluation of replication_synchro_quorum
Date: Wed, 25 Nov 2020 15:53:48 +0300	[thread overview]
Message-ID: <20201125125348.GA1231860@grain> (raw)
In-Reply-To: <b375398e-094b-d114-fde7-1c3b55d37bf8@tarantool.org>

On Wed, Nov 25, 2020 at 03:46:04PM +0300, Serge Petrenko wrote:
> 
> 25.11.2020 15:12, Cyrill Gorcunov пишет:
> > On Wed, Nov 25, 2020 at 03:04:07PM +0300, Serge Petrenko wrote:
> > > Just noticed. Looks like this diag_set and the one below are ignored:
> > > ```
> > > tarantool> a=string.rep('n', 1000)
> > > ---
> > > ...
> > > 
> > > tarantool> box.cfg{replication_synchro_quorum=a}
> > > ---
> > > - error: 'Incorrect value for option ''replication_synchro_quorum'': the
> > > value must
> > >      be greater than zero and less than maximal number of replicas'
> > > ...
> > Indeed. Actually if you remember I've been using errno for such errors.
> > Now we either should call diag_log() right after diag_set or return
> > errno handling?
> Why? Every time eval returns a value < 0 this means an error.
> Just add a check to check_replication_synchro_quorum.
> eval's return value is ignored here, and diag is rewritten with an unrelated
> error.

iow, you mean something like this?
---
static int
box_check_replication_synchro_quorum(void)
{
	int quorum = 0;

	if (!cfg_isnumber("replication_synchro_quorum")) {
		int value = replicaset.registered_count;
		quorum = box_eval_replication_synchro_quorum(value);
-->		if (quorum < 0)
-->			return -1;
	} else {
		quorum = cfg_geti("replication_synchro_quorum");
	}

	if (quorum <= 0 || quorum >= VCLOCK_MAX) {
		diag_set(ClientError, ER_CFG, "replication_synchro_quorum",
			 "the value must be greater than zero and less than "
			 "maximal number of replicas");
		return -1;
	}
	return quorum;
}

  reply	other threads:[~2020-11-25 12:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 15:24 [Tarantool-patches] [PATCH v2 0/3] qsync: evaluate replication_synchro_quorum dynamically Cyrill Gorcunov
2020-11-24 15:24 ` [Tarantool-patches] [PATCH v2 1/3] cfg: add cfg_isnumber helper Cyrill Gorcunov
2020-11-24 15:24 ` [Tarantool-patches] [PATCH v2 2/3] cfg: support symbolic evaluation of replication_synchro_quorum Cyrill Gorcunov
2020-11-25 11:36   ` Serge Petrenko
2020-11-25 11:55     ` Cyrill Gorcunov
2020-11-25 12:10       ` Serge Petrenko
2020-11-25 12:19         ` Cyrill Gorcunov
2020-11-25 12:04   ` Serge Petrenko
2020-11-25 12:12     ` Cyrill Gorcunov
2020-11-25 12:46       ` Serge Petrenko
2020-11-25 12:53         ` Cyrill Gorcunov [this message]
2020-11-25 13:49           ` Serge Petrenko
2020-11-24 15:24 ` [Tarantool-patches] [PATCH v2 3/3] test: add replication/gh-5446-sqync-eval-quorum.test.lua Cyrill Gorcunov
2020-11-25 13:57   ` Serge Petrenko
2020-11-25 14:10     ` Cyrill Gorcunov

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=20201125125348.GA1231860@grain \
    --to=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/3] cfg: support symbolic evaluation of replication_synchro_quorum' \
    /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