From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id E4A476C7D5; Thu, 11 Feb 2021 01:34:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E4A476C7D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612996498; bh=HlOrhACK5PDkey+6ap97Z7FleJTkAxQ+fu+OYal4Yhk=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Zj8+UUMe8vV9sLwR4CV/6x28WkZqoJZc72kerIcl6V8/Sz61NkGB6EMGB4+QS4/07 e3Bc1bupdtBe7JiKcgYxCn+0r+CEFP9QcbSiK9oa3pI7Pb/ztSkLgcMgSJT8tuTHOS mw6MMOZJSWqKKTw3fp9jU+erdaV6U4p0h155mjFI= Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6B1E26C7D5 for ; Thu, 11 Feb 2021 01:34:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6B1E26C7D5 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1l9y4R-0007YV-68; Thu, 11 Feb 2021 01:34:51 +0300 To: Oleg Babin , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <150f5ad2684cbeaf3b0aef2fd2a943dcfad23869.1612914070.git.v.shpilevoy@tarantool.org> <7c06b831-923d-4b3d-4f4f-6288b0aa67c0@tarantool.org> Message-ID: <1b189f47-1901-c55f-e103-80222c7730ff@tarantool.org> Date: Wed, 10 Feb 2021 23:34:50 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <7c06b831-923d-4b3d-4f4f-6288b0aa67c0@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9C55152E5B36F70094641E3870F0CF5304182A05F5380850404C91FFE129A586F2AA89AEAEA752DD3492F0FC25CDA59DEC104134059BC77E9A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72F22E6DC541F75D9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637317AD06F2A8D0AEF8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC5ED48DDBF877A9700C99CF8767138ACB0361C64CED0AE4F3389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0C26CFBAC0749D213D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BC908CD1B87A134A2A471835C12D1D977C4224003CC836476EC64975D915A344093EC92FD9297F6718AA50765F79006376A91CFDE938F542CA7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89F9FFED5BD9FB417555E1C53F199C2BB95B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBAF038BB36E94EA6B574AF45C6390F7469DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A56DB137A7550371017AA33F2214CE60D7117770E3DC4DA777D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F04B387B5D7535DE410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34BC3EEE75EF3BACCFFB2D806F9C544D0C29C7CB9891383723EF5453D084967E5FA311D2ACBEFFC9001D7E09C32AA3244C599A87049B8E4B86B7070607F9FDB9F13C6EB905E3A8056BFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmMmQ+JvDeDF4OV7XsX9oCQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638225F6AA272100F22BC68F4A27AE78EFF4B3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 6/9] cfg: introduce 'deprecated option' feature X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the review! On 10.02.2021 09:59, Oleg Babin wrote: > Thanks for your patch! > > Is it possible to extend log message to "Option is deprecated and has no effect anymore"? Good idea. See the diff in this commit. ==================== diff --git a/vshard/cfg.lua b/vshard/cfg.lua index 28c3400..f7d5dbc 100644 --- a/vshard/cfg.lua +++ b/vshard/cfg.lua @@ -61,7 +61,13 @@ local function validate_config(config, template, check_arg) local expected_type = template_value.type if template_value.is_deprecated then if value ~= nil then - log.warn('Option "%s" is deprecated', name) + local reason = template_value.reason + if reason then + reason = '. '..reason + else + reason = '' + end + log.warn('Option "%s" is deprecated'..reason, name) end elseif value == nil then if not template_value.is_optional then ==================== And in the next commit: ==================== diff --git a/vshard/cfg.lua b/vshard/cfg.lua index f7dd4c1..63d5414 100644 --- a/vshard/cfg.lua +++ b/vshard/cfg.lua @@ -252,6 +252,7 @@ local cfg_template = { }, collect_bucket_garbage_interval = { name = 'Garbage bucket collect interval', is_deprecated = true, + reason = 'Has no effect anymore' }, collect_lua_garbage = { type = 'boolean', name = 'Garbage Lua collect necessity', ==================== > Also for some options could be useful: "Option is deprecated, use ... instead" (e.g. for "weights"). With the updated version I can specify any 'reason'. Such as 'has no affect', 'use ... instead', etc. > Seems it should be more configurable and gives some hint for user to do. > > > On 10/02/2021 02:46, Vladislav Shpilevoy wrote: >> Some options in vshard are going to be eventually deprecated. For >> instance, 'weigts' will be renamed, 'collect_lua_garbage' may be > > > typo: weigts -> weights Fixed. See the full new patch below. ==================== cfg: introduce 'deprecated option' feature Some options in vshard are going to be eventually deprecated. For instance, 'weights' will be renamed, 'collect_lua_garbage' may be deleted since it appears not to be so useful, 'sync_timeout' is totally unnecessary since any 'sync' can take a timeout per-call. But the patch is motivated by 'collect_bucket_garbage_interval' which is going to become unused in the new GC algorithm. New GC will be reactive instead of proactive. Instead of periodic polling of _bucket space it will react on needed events immediately. This will make the 'collect interval' unused. The option will be deprecated and eventually in some far future release its usage will lead to an error. Needed for #147 diff --git a/vshard/cfg.lua b/vshard/cfg.lua index 1ef1899..f7d5dbc 100644 --- a/vshard/cfg.lua +++ b/vshard/cfg.lua @@ -59,7 +59,17 @@ local function validate_config(config, template, check_arg) local value = config[key] local name = template_value.name local expected_type = template_value.type - if value == nil then + if template_value.is_deprecated then + if value ~= nil then + local reason = template_value.reason + if reason then + reason = '. '..reason + else + reason = '' + end + log.warn('Option "%s" is deprecated'..reason, name) + end + elseif value == nil then if not template_value.is_optional then error(string.format('%s must be specified', name)) else ====================