From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9A200292F6 for ; Tue, 28 Aug 2018 07:43:48 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DLRtKp0gFeuu for ; Tue, 28 Aug 2018 07:43:48 -0400 (EDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 5267D2880C for ; Tue, 28 Aug 2018 07:43:48 -0400 (EDT) Received: by mail-lj1-f171.google.com with SMTP id u83-v6so1110645lje.12 for ; Tue, 28 Aug 2018 04:43:48 -0700 (PDT) From: Olga Arkhangelskaia Subject: [tarantool-patches] [PATCH 1/2] box: make replication_sync_lag option dynamic Date: Tue, 28 Aug 2018 14:43:27 +0300 Message-Id: <20180828114328.25702-1-krishtal.olja@gmail.com> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Olga Arkhangelskaia 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(); +} + 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, } 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) invalid('wal_mode', 'invalid') invalid('rows_per_wal', -1) invalid('listen', '//!') -- 2.14.3 (Apple Git-98)