[tarantool-patches] Re: [PATCH][vshard] Log warning on duplicate replica.name

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Jun 7 22:05:10 MSK 2018


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 at 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





More information about the Tarantool-patches mailing list