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 7777324D85 for ; Sat, 7 Sep 2019 12:02:03 -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 x9aUbePJg9tl for ; Sat, 7 Sep 2019 12:02:03 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 7C83620C5D for ; Sat, 7 Sep 2019 12:02:02 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/2] wal: deprecate rows_per_wal in favour of wal_max_size Date: Sat, 7 Sep 2019 18:05:36 +0200 Message-Id: <15b6e108adb8c2241e1213a4ac399f959850ba8f.1567872249.git.v.shpilevoy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: alexander.turenko@tarantool.org rows_per_wal does not allow to properly limit size of WAL logs. A user would need to estimate size of each WAL row to do that. Now WAL supports option wal_max_size allowing to limit WAL size much more precise. Part of #3762 --- src/box/lua/load_cfg.lua | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index d402468ab..4432e0d08 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -283,19 +283,32 @@ local function convert_gb(size) return math.floor(size * 1024 * 1024 * 1024) end --- Old to new config translation tables +-- Old to new config translation tables. In case a translation is +-- not 1-to-1, then a function can be used. It takes 2 parameters: +-- value of the old option, value of the new if present. It +-- returns two values - value to replace the old option and to +-- replace the new one. local translate_cfg = { snapshot_count = {'checkpoint_count'}, snapshot_period = {'checkpoint_interval'}, - slab_alloc_arena = {'memtx_memory', convert_gb}, + slab_alloc_arena = {'memtx_memory', function(old) + return nil, convert_gb(old) + end}, slab_alloc_minimal = {'memtx_min_tuple_size'}, slab_alloc_maximal = {'memtx_max_tuple_size'}, snap_dir = {'memtx_dir'}, logger = {'log'}, logger_nonblock = {'log_nonblock'}, - panic_on_snap_error = {'force_recovery', function (p) return not p end}, - panic_on_wal_error = {'force_recovery', function (p) return not p end}, + panic_on_snap_error = {'force_recovery', function(old) + return nil, not old end + }, + panic_on_wal_error = {'force_recovery', function(old) + return nil, not old end + }, replication_source = {'replication'}, + rows_per_wal = {'wal_max_size', function(old, new) + return old, new + end}, } -- Upgrade old config @@ -307,19 +320,23 @@ local function upgrade_cfg(cfg, translate_cfg) for k, v in pairs(cfg) do local translation = translate_cfg[k] if translation ~= nil then - log.warn('Deprecated option %s, please use %s instead', k, translation[1]) - local new_val - if translation[2] == nil then + local new_key = translation[1] + local transofm = translation[2] + log.warn('Deprecated option %s, please use %s instead', k, new_key) + local new_val_orig = cfg[new_key] + local old_val, new_val + if transofm == nil then new_val = v else - new_val = translation[2](v) + old_val, new_val = transofm(v, new_val_orig) end - if cfg[translation[1]] ~= nil and - cfg[translation[1]] ~= new_val then + if new_val_orig ~= nil and + new_val_orig ~= new_val then box.error(box.error.CFG, k, 'can not override a value for a deprecated option') end - result_cfg[translation[1]] = new_val + result_cfg[k] = old_val + result_cfg[new_key] = new_val else result_cfg[k] = v end -- 2.20.1 (Apple Git-117)