hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [hbase] branch branch-2 updated: HBASE-23014 Should not show split parent regions in hbck report UI (#609)
Date Wed, 11 Sep 2019 17:13:17 GMT
This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 9f31d74  HBASE-23014 Should not show split parent regions in hbck report UI (#609)
9f31d74 is described below

commit 9f31d744f6be274674c3bc8d8a0d93ccaa4a74a7
Author: Guanghao Zhang <zghao@apache.org>
AuthorDate: Thu Sep 12 01:07:26 2019 +0800

    HBASE-23014 Should not show split parent regions in hbck report UI (#609)
---
 .../org/apache/hadoop/hbase/client/RegionInfo.java   |  4 ++--
 .../apache/hadoop/hbase/master/CatalogJanitor.java   |  4 ++++
 .../org/apache/hadoop/hbase/master/HbckChore.java    | 12 ++++++++++--
 .../hbase/master/assignment/TestHbckChore.java       | 20 ++++++++++++++++++++
 .../hadoop/hbase/regionserver/TestHRegionInfo.java   |  5 -----
 5 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
index 836578c..7a03e05 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
@@ -802,11 +802,11 @@ public interface RegionInfo {
     }
     int startKeyCompare = Bytes.compareTo(getStartKey(), other.getStartKey());
     if (startKeyCompare == 0) {
-      return !this.isSplitParent();
+      return true;
     }
     if (startKeyCompare < 0) {
       if (isLast()) {
-        return !this.isSplitParent();
+        return true;
       }
       return Bytes.compareTo(getEndKey(), other.getStartKey()) > 0;
     }
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
index ec75e0b..dbe3599 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
@@ -617,6 +617,10 @@ public class CatalogJanitor extends ScheduledChore {
             Bytes.toStringBinary(metaTableRow.getRow()), ri.getRegionNameAsString());
         return null;
       }
+      // Skip split parent region
+      if (ri.isSplitParent()) {
+        return ri;
+      }
       // If table is disabled, skip integrity check.
       if (!isTableDisabled(ri)) {
         if (isTableTransition(ri)) {
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChore.java
index 5bb4e95..d144937 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChore.java
@@ -62,6 +62,7 @@ public class HbckChore extends ScheduledChore {
   private final Map<String, HbckRegionInfo> regionInfoMap = new HashMap<>();
 
   private final Set<String> disabledTableRegions = new HashSet<>();
+  private final Set<String> splitParentRegions = new HashSet<>();
 
   /**
    * The regions only opened on RegionServers, but no region info in meta.
@@ -124,6 +125,7 @@ public class HbckChore extends ScheduledChore {
     running = true;
     regionInfoMap.clear();
     disabledTableRegions.clear();
+    splitParentRegions.clear();
     orphanRegionsOnRS.clear();
     orphanRegionsOnFS.clear();
     inconsistentRegions.clear();
@@ -190,6 +192,9 @@ public class HbckChore extends ScheduledChore {
           .isTableState(regionInfo.getTable(), TableState.State.DISABLED)) {
         disabledTableRegions.add(regionInfo.getEncodedName());
       }
+      if (regionInfo.isSplitParent()) {
+        splitParentRegions.add(regionInfo.getEncodedName());
+      }
       HbckRegionInfo.MetaEntry metaEntry =
           new HbckRegionInfo.MetaEntry(regionInfo, regionState.getServerName(),
               regionState.getStamp());
@@ -222,11 +227,14 @@ public class HbckChore extends ScheduledChore {
       HbckRegionInfo hri = entry.getValue();
       ServerName locationInMeta = hri.getMetaEntry().getRegionServer();
       if (hri.getDeployedOn().size() == 0) {
-        // Because the inconsistent regions are not absolutely right, only skip the offline
regions
-        // which belong to disabled table.
+        // skip the offline region which belong to disabled table.
         if (disabledTableRegions.contains(encodedRegionName)) {
           continue;
         }
+        // skip the split parent regions
+        if (splitParentRegions.contains(encodedRegionName)) {
+          continue;
+        }
         // Master thought this region opened, but no regionserver reported it.
         inconsistentRegions.put(encodedRegionName, new Pair<>(locationInMeta, new LinkedList<>()));
       } else if (hri.getDeployedOn().size() > 1) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestHbckChore.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestHbckChore.java
index a367318..4c0a194 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestHbckChore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestHbckChore.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.master.TableStateManager;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.Pair;
 import org.junit.Before;
@@ -181,6 +182,25 @@ public class TestHbckChore extends TestAssignmentManagerBase {
   }
 
   @Test
+  public void testForSplitParent() throws Exception {
+    TableName tableName = TableName.valueOf("testForSplitParent");
+    RegionInfo hri = RegionInfoBuilder.newBuilder(tableName).setStartKey(Bytes.toBytes(0))
+        .setEndKey(Bytes.toBytes(1)).setSplit(true).setOffline(true).setRegionId(0).build();
+    String regionName = hri.getEncodedName();
+    rsDispatcher.setMockRsExecutor(new GoodRsExecutor());
+    Future<byte[]> future = submitProcedure(createAssignProcedure(hri));
+    waitOnFuture(future);
+
+    List<ServerName> serverNames = master.getServerManager().getOnlineServersList();
+    assertEquals(NSERVERS, serverNames.size());
+
+    hbckChore.choreForTesting();
+    Map<String, Pair<ServerName, List<ServerName>>> inconsistentRegions
=
+        hbckChore.getInconsistentRegions();
+    assertFalse(inconsistentRegions.containsKey(regionName));
+  }
+
+  @Test
   public void testOrphanRegionsOnFS() throws Exception {
     TableName tableName = TableName.valueOf("testOrphanRegionsOnFS");
     RegionInfo regionInfo = RegionInfoBuilder.newBuilder(tableName).build();
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
index d1cbd92..ff95f59 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
@@ -129,11 +129,6 @@ public class TestHRegionInfo {
     assertFalse(dri.isOverlap(ari));
     assertTrue(abri.isOverlap(adri));
     assertTrue(adri.isOverlap(abri));
-    // Check that splitParent is not reported as an overlap.
-    RegionInfo splitParent = RegionInfoBuilder.newBuilder(adri.getTable()).
-        setStartKey(adri.getStartKey()).setEndKey(adri.getEndKey()).setOffline(true).
-        setSplit(true).build();
-    assertFalse(splitParent.isOverlap(abri));
   }
 
   @Test


Mime
View raw message