From 1acb6fc16bba6b69d570c717de0a306a8e0c55e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=87=AF?= Date: Wed, 6 Jan 2021 10:16:01 +0800 Subject: [PATCH 1/4] HBASE-24755 [LOG][RSGroup]Error message is confusing while adding a offline RS to rsgroup --- .../org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java index a1bc9edaab66..ca277fa1645f 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java @@ -397,9 +397,7 @@ public void moveServers(Set
servers, String targetGroupName) throws IOE Address firstServer = servers.iterator().next(); RSGroupInfo srcGrp = rsGroupInfoManager.getRSGroupOfServer(firstServer); if (srcGrp == null) { - // Be careful. This exception message is tested for in TestRSGroupsBase... - throw new ConstraintException("Source RSGroup for server " + firstServer - + " does not exist."); + throw new ConstraintException("Server " + firstServer + " does not exist or offline."); } // Only move online servers (when moving from 'default') or servers from other // groups. This prevents bogus servers from entering groups From 3e1ca3734172067788ffdec08cac2974e362f38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=87=AF?= Date: Wed, 6 Jan 2021 11:09:24 +0800 Subject: [PATCH 2/4] HBASE-24755 [LOG][RSGroup]Error message is confusing while adding a offline RS to rsgroup --- .../org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java | 1 + .../org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java index ca277fa1645f..f274fe1140d3 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java @@ -397,6 +397,7 @@ public void moveServers(Set
servers, String targetGroupName) throws IOE Address firstServer = servers.iterator().next(); RSGroupInfo srcGrp = rsGroupInfoManager.getRSGroupOfServer(firstServer); if (srcGrp == null) { + // Be careful. This exception message is tested for in TestRSGroupsAdmin2... throw new ConstraintException("Server " + firstServer + " does not exist or offline."); } // Only move online servers (when moving from 'default') or servers from other diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java index 8bad42325ebd..a4e4dfdc4820 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java @@ -185,7 +185,7 @@ public void testMoveServers() throws Exception { rsGroupAdmin.moveServers(Sets.newHashSet(Address.fromString("foo:9999")), "foo"); fail("Bogus servers shouldn't have been successfully moved."); } catch (IOException ex) { - String exp = "Source RSGroup for server foo:9999 does not exist."; + String exp = "Server foo:9999 does not exist or offline."; String msg = "Expected '" + exp + "' in exception message: "; assertTrue(msg + " " + ex.getMessage(), ex.getMessage().contains(exp)); } @@ -333,7 +333,7 @@ public boolean evaluate() throws Exception { Sets.newHashSet(tableName), newGroup.getName()); fail("Bogus servers shouldn't have been successfully moved."); } catch (IOException ex) { - String exp = "Source RSGroup for server foo:9999 does not exist."; + String exp = "Server foo:9999 does not exist or offline."; String msg = "Expected '" + exp + "' in exception message: "; assertTrue(msg + " " + ex.getMessage(), ex.getMessage().contains(exp)); } From 737ea9162d69e29a1541ba32ace6bbdd7449d043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=87=AF?= Date: Wed, 6 Jan 2021 11:36:43 +0800 Subject: [PATCH 3/4] HBASE-24755 [LOG][RSGroup]Error message is confusing while adding a offline RS to rsgroup --- .../org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java index f274fe1140d3..8b29836634c9 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java @@ -159,9 +159,8 @@ private void checkServersAndTables(Set
servers, Set tables, Address firstServer = servers.iterator().next(); RSGroupInfo tmpSrcGrp = rsGroupInfoManager.getRSGroupOfServer(firstServer); if (tmpSrcGrp == null) { - // Be careful. This exception message is tested for in TestRSGroupsBase... - throw new ConstraintException("Source RSGroup for server " + firstServer - + " does not exist."); + // Be careful. This exception message is tested for in TestRSGroupsAdmin2... + throw new ConstraintException("Server " + firstServer + " does not exist or offline."); } RSGroupInfo srcGrp = new RSGroupInfo(tmpSrcGrp); From 28aa72a3574ceb54f40ed49e51496181fa8b0bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=87=AF?= Date: Wed, 6 Jan 2021 15:45:55 +0800 Subject: [PATCH 4/4] HBASE-24755 [LOG][RSGroup]Error message is confusing while adding a offline RS to rsgroup --- .../org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java | 6 ++++-- .../org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java index 8b29836634c9..b284a2b7586a 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java @@ -160,7 +160,8 @@ private void checkServersAndTables(Set
servers, Set tables, RSGroupInfo tmpSrcGrp = rsGroupInfoManager.getRSGroupOfServer(firstServer); if (tmpSrcGrp == null) { // Be careful. This exception message is tested for in TestRSGroupsAdmin2... - throw new ConstraintException("Server " + firstServer + " does not exist or offline."); + throw new ConstraintException("Server " + firstServer + + " is either offline or it does not exist."); } RSGroupInfo srcGrp = new RSGroupInfo(tmpSrcGrp); @@ -397,7 +398,8 @@ public void moveServers(Set
servers, String targetGroupName) throws IOE RSGroupInfo srcGrp = rsGroupInfoManager.getRSGroupOfServer(firstServer); if (srcGrp == null) { // Be careful. This exception message is tested for in TestRSGroupsAdmin2... - throw new ConstraintException("Server " + firstServer + " does not exist or offline."); + throw new ConstraintException("Server " + firstServer + + " is either offline or it does not exist."); } // Only move online servers (when moving from 'default') or servers from other // groups. This prevents bogus servers from entering groups diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java index a4e4dfdc4820..5e3fc5d3ffd6 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java @@ -185,7 +185,7 @@ public void testMoveServers() throws Exception { rsGroupAdmin.moveServers(Sets.newHashSet(Address.fromString("foo:9999")), "foo"); fail("Bogus servers shouldn't have been successfully moved."); } catch (IOException ex) { - String exp = "Server foo:9999 does not exist or offline."; + String exp = "Server foo:9999 is either offline or it does not exist."; String msg = "Expected '" + exp + "' in exception message: "; assertTrue(msg + " " + ex.getMessage(), ex.getMessage().contains(exp)); } @@ -333,7 +333,7 @@ public boolean evaluate() throws Exception { Sets.newHashSet(tableName), newGroup.getName()); fail("Bogus servers shouldn't have been successfully moved."); } catch (IOException ex) { - String exp = "Server foo:9999 does not exist or offline."; + String exp = "Server foo:9999 is either offline or it does not exist."; String msg = "Expected '" + exp + "' in exception message: "; assertTrue(msg + " " + ex.getMessage(), ex.getMessage().contains(exp)); }