Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Olga Arkhangelskaia <krishtal.olja@gmail.com>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH 1/2] box: make replication_sync_lag option dynamic
Date: Tue, 28 Aug 2018 17:03:14 +0300	[thread overview]
Message-ID: <20180828140314.3nzvxghtphdasoui@esperanza> (raw)
In-Reply-To: <20180828114328.25702-1-krishtal.olja@gmail.com>

On Tue, Aug 28, 2018 at 02:43:27PM +0300, Olga Arkhangelskaia wrote:
> In gh-3427 replication_sync_lag should be taken into account during
> replication reconfiguration. In order to configure replication properly
> this parameter is made dynamical and can be changed on demand.
> 
> @TarantoolBot document
> Title: recation_sync_lag option can be set dynamically
> recation_sync_lag now can be set at any time.
> ---
>  src/box/box.cc            |  6 ++++++
>  src/box/box.h             |  1 +
>  src/box/lua/cfg.cc        | 12 ++++++++++++
>  src/box/lua/load_cfg.lua  |  1 +
>  test/box-tap/cfg.test.lua |  4 +++-
>  5 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/src/box/box.cc b/src/box/box.cc
> index 8d7454d1f..be5077da8 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -656,6 +656,12 @@ box_set_replication_connect_quorum(void)
>  		replicaset_check_quorum();
>  }
>  
> +void
> +box_set_replication_sync_lag(void)
> +{
> +	replication_sync_lag = box_check_replication_sync_lag();
> +}
> +

Nit: you can now use this function in box_cfg_xc() instead of

	replication_sync_lag = box_check_replication_sync_lag();

Please do.

>  void
>  box_bind(void)
>  {
> diff --git a/src/box/box.h b/src/box/box.h
> index 9dfb3fd2a..3090fdcdb 100644
> --- a/src/box/box.h
> +++ b/src/box/box.h
> @@ -176,6 +176,7 @@ void box_set_vinyl_timeout(void);
>  void box_set_replication_timeout(void);
>  void box_set_replication_connect_timeout(void);
>  void box_set_replication_connect_quorum(void);
> +void box_set_replication_sync_lag(void);
>  
>  extern "C" {
>  #endif /* defined(__cplusplus) */
> diff --git a/src/box/lua/cfg.cc b/src/box/lua/cfg.cc
> index 0ca150877..5442723b5 100644
> --- a/src/box/lua/cfg.cc
> +++ b/src/box/lua/cfg.cc
> @@ -262,6 +262,17 @@ lbox_cfg_set_replication_connect_quorum(struct lua_State *L)
>  	return 0;
>  }
>  
> +static int
> +lbox_cfg_set_replication_sync_lag(struct lua_State *L)
> +{
> +	try {
> +		box_set_replication_sync_lag();
> +	} catch (Exception *) {
> +		luaT_error(L);
> +	}
> +	return 0;
> +}
> +
>  void
>  box_lua_cfg_init(struct lua_State *L)
>  {
> @@ -286,6 +297,7 @@ box_lua_cfg_init(struct lua_State *L)
>  		{"cfg_set_replication_timeout", lbox_cfg_set_replication_timeout},
>  		{"cfg_set_replication_connect_timeout", lbox_cfg_set_replication_connect_timeout},
>  		{"cfg_set_replication_connect_quorum", lbox_cfg_set_replication_connect_quorum},
> +		{"cfg_set_replication_sync_lag", lbox_cfg_set_replication_sync_lag},
>  		{NULL, NULL}
>  	};
>  
> diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
> index 2a7142de6..cdee475d5 100644
> --- a/src/box/lua/load_cfg.lua
> +++ b/src/box/lua/load_cfg.lua
> @@ -211,6 +211,7 @@ local dynamic_cfg = {
>                        'Can\'t change replicaset uuid')
>          end
>      end,
> +    replication_sync_lag    = private.cfg_set_replication_sync_lag,

Nit: please move this option definition closer to replication_timeout
and friends.

Also, you should add this option to dynamic_cfg_skip_at_load, because it
is initialized by box_cfg_xc().

>  }
>  
>  local dynamic_cfg_skip_at_load = {
> diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua
> index 5e72004ca..7cb2ed9a3 100755
> --- a/test/box-tap/cfg.test.lua
> +++ b/test/box-tap/cfg.test.lua
> @@ -6,7 +6,7 @@ local socket = require('socket')
>  local fio = require('fio')
>  local uuid = require('uuid')
>  local msgpack = require('msgpack')
> -test:plan(90)
> +test:plan(92)
>  
>  --------------------------------------------------------------------------------
>  -- Invalid values
> @@ -32,6 +32,8 @@ invalid('replication_sync_lag', 0)
>  invalid('replication_connect_timeout', -1)
>  invalid('replication_connect_timeout', 0)
>  invalid('replication_connect_quorum', -1)
> +invalid('replication_sync_lag', -1)
> +invalid('replication_sync_lag', -1)

The same value is tested twice. Besides, this is already tested a few
lines above.

What you should test is that replication_sync_lag can now be changed
after initial configuration. Please do.

>  invalid('wal_mode', 'invalid')
>  invalid('rows_per_wal', -1)
>  invalid('listen', '//!')

      parent reply	other threads:[~2018-08-28 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 11:43 Olga Arkhangelskaia
2018-08-28 11:43 ` [tarantool-patches] [PATCH v4 2/2] box: adds replication sync after cfg. update Olga Arkhangelskaia
2018-08-28 15:58   ` Vladimir Davydov
2018-08-28 16:19     ` Olga Krishtal
2018-08-28 16:36       ` Vladimir Davydov
2018-08-28 14:03 ` Vladimir Davydov [this message]

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=20180828140314.3nzvxghtphdasoui@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=krishtal.olja@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/2] box: make replication_sync_lag option dynamic' \
    /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