[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-16 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324960890
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
 ##
 @@ -1923,12 +1923,23 @@ private void processAssignQueue() {
   LOG.debug("Processing assignQueue; systemServersCount=" + 
serversForSysTables.size() +
   ", allServersCount=" + servers.size());
   processAssignmentPlans(regions, null, systemHRIs,
-  serversForSysTables.isEmpty()? servers: serversForSysTables);
+  serversForSysTables.isEmpty() && !containsBogusAssignments(regions, 
systemHRIs) ?
+  servers: serversForSysTables);
 }
 
 processAssignmentPlans(regions, retainMap, userHRIs, servers);
   }
 
+  private boolean containsBogusAssignments(Map 
regions, List hirs){
+for (RegionInfo ri : hirs) {
+  if (regions.get(ri).getRegionLocation() != null &&
+  
regions.get(ri).getRegionLocation().equals(LoadBalancer.BOGUS_SERVER_NAME)){
 
 Review comment:
   Ok. Separate issue though I'd say. Others might be interested in the 
discussion.
   
   Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-14 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324429507
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
 ##
 @@ -1923,12 +1923,23 @@ private void processAssignQueue() {
   LOG.debug("Processing assignQueue; systemServersCount=" + 
serversForSysTables.size() +
   ", allServersCount=" + servers.size());
   processAssignmentPlans(regions, null, systemHRIs,
-  serversForSysTables.isEmpty()? servers: serversForSysTables);
+  serversForSysTables.isEmpty() && !containsBogusAssignments(regions, 
systemHRIs) ?
+  servers: serversForSysTables);
 }
 
 processAssignmentPlans(regions, retainMap, userHRIs, servers);
   }
 
+  private boolean containsBogusAssignments(Map 
regions, List hirs){
+for (RegionInfo ri : hirs) {
+  if (regions.get(ri).getRegionLocation() != null &&
+  
regions.get(ri).getRegionLocation().equals(LoadBalancer.BOGUS_SERVER_NAME)){
 
 Review comment:
   File an issue to purge this whole BOGUS_SERVER_NAME thing. It is just wrong, 
especially now rsgroup is integrated into core.
   
   Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-14 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324429382
 
 

 ##
 File path: hbase-common/src/saveVersion.sh
 ##
 @@ -71,7 +71,7 @@ import org.apache.yetus.audience.InterfaceAudience;
 
 @InterfaceAudience.Private
 public class Version {
-  public static final String version = "$version";
+  public static final String version = new String("$version");
 
 Review comment:
   Isn't it a String already?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-14 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324429440
 
 

 ##
 File path: 
hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsKillRS.java
 ##
 @@ -224,4 +228,54 @@ public void testKillAllRSInGroup() throws Exception {
 // wait and check if table regions are online
 TEST_UTIL.waitTableAvailable(tableName, 3);
   }
+
+  @Test
+  public void testLowerMetaGroupVersion() throws Exception{
+// create a rsgroup and move one regionserver to it
+String groupName = "meta_group";
+int groupRSCount = 1;
+addGroup(groupName, groupRSCount);
+
+// move hbase:meta to meta_group
+tableName = TableName.META_TABLE_NAME;
+Set toAddTables = new HashSet<>();
+toAddTables.add(tableName);
+rsGroupAdmin.moveTables(toAddTables, groupName);
+
assertTrue(rsGroupAdmin.getRSGroupInfo(groupName).getTables().contains(tableName));
+TEST_UTIL.waitTableAvailable(tableName, 3);
+
+// restart the regionserver in meta_group, and lower its version
+String originVersion = "";
+Set servers = new HashSet<>();
+for(Address addr : rsGroupAdmin.getRSGroupInfo(groupName).getServers()) {
+  servers.add(addr);
+  TEST_UTIL.getMiniHBaseCluster().stopRegionServer(getServerName(addr));
+  originVersion = master.getRegionServerVersion(getServerName(addr));
+}
+// better wait for a while for region reassign
+sleep(1);
+assertEquals(NUM_SLAVES_BASE - groupRSCount,
+TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size());
+Address address = servers.iterator().next();
+int majorVersion = Integer.parseInt(originVersion.split("\\.")[0]);
 
 Review comment:
   Add a method to the VersionInfo getMajorVersion ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-14 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324429463
 
 

 ##
 File path: 
hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsKillRS.java
 ##
 @@ -224,4 +228,54 @@ public void testKillAllRSInGroup() throws Exception {
 // wait and check if table regions are online
 TEST_UTIL.waitTableAvailable(tableName, 3);
   }
+
+  @Test
+  public void testLowerMetaGroupVersion() throws Exception{
+// create a rsgroup and move one regionserver to it
+String groupName = "meta_group";
+int groupRSCount = 1;
+addGroup(groupName, groupRSCount);
+
+// move hbase:meta to meta_group
+tableName = TableName.META_TABLE_NAME;
+Set toAddTables = new HashSet<>();
+toAddTables.add(tableName);
+rsGroupAdmin.moveTables(toAddTables, groupName);
+
assertTrue(rsGroupAdmin.getRSGroupInfo(groupName).getTables().contains(tableName));
+TEST_UTIL.waitTableAvailable(tableName, 3);
+
+// restart the regionserver in meta_group, and lower its version
+String originVersion = "";
+Set servers = new HashSet<>();
+for(Address addr : rsGroupAdmin.getRSGroupInfo(groupName).getServers()) {
+  servers.add(addr);
+  TEST_UTIL.getMiniHBaseCluster().stopRegionServer(getServerName(addr));
+  originVersion = master.getRegionServerVersion(getServerName(addr));
+}
+// better wait for a while for region reassign
+sleep(1);
+assertEquals(NUM_SLAVES_BASE - groupRSCount,
+TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size());
+Address address = servers.iterator().next();
+int majorVersion = Integer.parseInt(originVersion.split("\\.")[0]);
+assertTrue(majorVersion >= 1);
+String lowerVersion = String.valueOf(majorVersion - 1) + 
originVersion.split("\\.")[1];
+setFinalStatic(Version.class.getField("version"), lowerVersion);
+TEST_UTIL.getMiniHBaseCluster().startRegionServer(address.getHostname(),
+address.getPort());
+assertEquals(NUM_SLAVES_BASE,
+TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size());
+assertTrue(VersionInfo.compareVersion(originVersion,
+
master.getRegionServerVersion(getServerName(servers.iterator().next( > 0);
+LOG.debug("wait for META assigned...");
+TEST_UTIL.waitTableAvailable(tableName, 3);
+  }
+
+  private static void setFinalStatic(Field field, Object newValue) throws 
Exception {
+field.setAccessible(true);
+Field modifiersField = Field.class.getDeclaredField("modifiers");
+modifiersField.setAccessible(true);
+modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+field.set(null, newValue);
+  }
 }
 
 Review comment:
   Good test.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] saintstack commented on a change in pull request #435: HBASE-22767 System table RIT STUCK if their RSGroup has no highest ve…

2019-09-14 Thread GitBox
saintstack commented on a change in pull request #435: HBASE-22767 System table 
RIT STUCK if their RSGroup has no highest ve…
URL: https://github.com/apache/hbase/pull/435#discussion_r324429366
 
 

 ##
 File path: hbase-common/src/saveVersion.sh
 ##
 @@ -71,7 +71,7 @@ import org.apache.yetus.audience.InterfaceAudience;
 
 @InterfaceAudience.Private
 public class Version {
-  public static final String version = "$version";
+  public static final String version = new String("$version");
 
 Review comment:
   Why make this change?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services