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 5678F25E72 for ; Thu, 7 Jun 2018 15:05:14 -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 SvBcoIl3xSie for ; Thu, 7 Jun 2018 15:05:14 -0400 (EDT) Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (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 0FAD725E71 for ; Thu, 7 Jun 2018 15:05:13 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH][vshard] Log warning on duplicate replica.name References: <20180607115043.3851-1-avkhatskevich@tarantool.org> <26948b8a-a552-d558-df71-490c81916d7f@tarantool.org> From: Vladislav Shpilevoy Message-ID: <77a9d201-6cad-c92f-3cdf-d667a14705f3@tarantool.org> Date: Thu, 7 Jun 2018 22:05:10 +0300 MIME-Version: 1.0 In-Reply-To: <26948b8a-a552-d558-df71-490c81916d7f@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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, Alex Khatskevich Great! Thanks for the fixes! But see the diff that I applied and pushed into the master branch: diff --git a/test/unit/config.result b/test/unit/config.result index b82303b..6b4f87b 100644 --- a/test/unit/config.result +++ b/test/unit/config.result @@ -161,9 +161,9 @@ cfg.sharding['rsid2'] = replicaset2 _ = check(cfg) --- ... -test_run:grep_log('default', 'Duplicate replica.name found: dup_name1') +test_run:grep_log('default', 'Duplicate replica.name is found: dup_name1') --- -- 'Duplicate replica.name found: dup_name1' +- 'Duplicate replica.name is found: dup_name1' ... cfg.sharding['rsid2'] = nil --- @@ -190,9 +190,9 @@ cfg.sharding['rsid3'] = replicaset3 _ = check(cfg) --- ... -test_run:grep_log('default', 'Duplicate replica.name found: dup_name2') +test_run:grep_log('default', 'Duplicate replica.name is found: dup_name2') --- -- 'Duplicate replica.name found: dup_name2' +- 'Duplicate replica.name is found: dup_name2' ... cfg.sharding['rsid2'] = nil --- diff --git a/test/unit/config.test.lua b/test/unit/config.test.lua index 9b2b7be..0f549d3 100644 --- a/test/unit/config.test.lua +++ b/test/unit/config.test.lua @@ -75,7 +75,7 @@ replica2_2 = {uri = 'uri:uri@uri2_2', name = 'dup_name1', master = false} replicaset2 = {replicas = {['id2'] = replica2_1, ['id3'] = replica2_2}} cfg.sharding['rsid2'] = replicaset2 _ = check(cfg) -test_run:grep_log('default', 'Duplicate replica.name found: dup_name1') +test_run:grep_log('default', 'Duplicate replica.name is found: dup_name1') cfg.sharding['rsid2'] = nil -- name duplicate in different replicasets. @@ -86,7 +86,7 @@ replicaset3 = {replicas = {['id3'] = replica3}} cfg.sharding['rsid2'] = replicaset2 cfg.sharding['rsid3'] = replicaset3 _ = check(cfg) -test_run:grep_log('default', 'Duplicate replica.name found: dup_name2') +test_run:grep_log('default', 'Duplicate replica.name is found: dup_name2') cfg.sharding['rsid2'] = nil cfg.sharding['rsid3'] = nil diff --git a/vshard/cfg.lua b/vshard/cfg.lua index 7a25cc9..f5db4c0 100644 --- a/vshard/cfg.lua +++ b/vshard/cfg.lua @@ -160,14 +160,15 @@ local function check_sharding(sharding) error(string.format('Duplicate uuid %s', replica_uuid)) end uuids[replica_uuid] = true - -- Log warning in case replica.name duplicate found. - -- Message appears once for each unique duplicate. + -- Log warning in case replica.name duplicate is + -- found. Message appears once for each unique + -- duplicate. local name = replica.name if name then if names[name] == nil then names[name] = 1 elseif names[name] == 1 then - log.warn('Duplicate replica.name found: %s', name) + log.warn('Duplicate replica.name is found: %s', name) -- Next duplicates should not be reported. names[name] = 2 end