From: Olga Arkhangelskaia <krishtal.olja@gmail.com> To: tarantool-patches@freelists.org Cc: Olga Arkhangelskaia <krishtal.olja@gmail.com> Subject: [tarantool-patches] [PATCH 1/3] box: make replication_sync_lag option dynamic Date: Fri, 31 Aug 2018 02:38:02 +0300 [thread overview] Message-ID: <20180830233804.20727-1-krishtal.olja@gmail.com> (raw) 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 | 8 +++++++- src/box/box.h | 1 + src/box/lua/cfg.cc | 12 ++++++++++++ src/box/lua/load_cfg.lua | 2 ++ test/box-tap/cfg.test.lua | 7 ++++++- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index 8d7454d1f..7155ad085 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(); +} + void box_bind(void) { @@ -1747,7 +1753,7 @@ box_cfg_xc(void) box_set_replication_timeout(); box_set_replication_connect_timeout(); box_set_replication_connect_quorum(); - replication_sync_lag = box_check_replication_sync_lag(); + box_set_replication_sync_lag(); xstream_create(&join_stream, apply_initial_join_row); xstream_create(&subscribe_stream, apply_row); 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..f803d8987 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -199,6 +199,7 @@ local dynamic_cfg = { replication_timeout = private.cfg_set_replication_timeout, replication_connect_timeout = private.cfg_set_replication_connect_timeout, replication_connect_quorum = private.cfg_set_replication_connect_quorum, + replication_sync_lag = private.cfg_set_replication_sync_lag, instance_uuid = function() if box.cfg.instance_uuid ~= box.info.uuid then box.error(box.error.CFG, 'instance_uuid', @@ -220,6 +221,7 @@ local dynamic_cfg_skip_at_load = { replication_timeout = true, replication_connect_timeout = true, replication_connect_quorum = true, + replication_sync_lag = true, wal_dir_rescan_delay = true, custom_proc_title = true, force_recovery = true, diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua index 5e72004ca..d315346de 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(91) -------------------------------------------------------------------------------- -- Invalid values @@ -95,6 +95,11 @@ test:ok(status and result == 'table', 'configured box') invalid('log_level', 'unknown') +lag = box.cfg.replication_sync_lag +status, result = pcall(box.cfg, {replication_sync_lag = 1}) +test:ok(status, "dynamic replication_sync_lag") +pcall(box.cfg, {repliction_sync_lag = lag}) + -------------------------------------------------------------------------------- -- gh-534: Segmentation fault after two bad wal_mode settings -------------------------------------------------------------------------------- -- 2.14.3 (Apple Git-98)
next reply other threads:[~2018-08-30 23:38 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-30 23:38 Olga Arkhangelskaia [this message] 2018-08-30 23:38 ` [tarantool-patches] [PATCH v3 2/3] box: add replication_sync_timeout Olga Arkhangelskaia 2018-08-30 23:38 ` [tarantool-patches] [PATCH v7 3/3] box: adds replication sync after cfg. update Olga Arkhangelskaia 2018-08-31 13:01 ` Vladimir Davydov 2018-09-04 13:24 ` [tarantool-patches] Re: [PATCH 1/3] box: make replication_sync_lag option dynamic Kirill Yukhin -- strict thread matches above, loose matches on Subject: below -- 2018-08-30 14:11 [tarantool-patches] " Olga Arkhangelskaia
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=20180830233804.20727-1-krishtal.olja@gmail.com \ --to=krishtal.olja@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH 1/3] 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