Apache9 commented on a change in pull request #1746:
URL: https://github.com/apache/hbase/pull/1746#discussion_r428401590



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -866,6 +877,50 @@ protected AssignmentManager 
createAssignmentManager(MasterServices master) {
     return new AssignmentManager(master);
   }
 
+  private void createRootTable() throws IOException, KeeperException {
+    RootTable rootTable = new RootTable(this, cleanerPool);
+    rootTable.initialize();
+    // try migrate data from zookeeper
+    try (RegionScanner scanner =
+      rootTable.getScanner(new Scan().addFamily(HConstants.CATALOG_FAMILY))) {
+      List<Cell> cells = new ArrayList<>();
+      boolean moreRows = scanner.next(cells);
+      if (!cells.isEmpty() || moreRows) {
+        // notice that all replicas for a region are in the same row, so the 
migration can be
+        // done with in a one row put, which means if we have data in root 
table then we can make
+        // sure that the migration is done.
+        LOG.info("Root table already has data in it, skip migrating...");
+        this.rootTable = rootTable;
+        return;
+      }
+    }
+    // start migrating
+    byte[] row = 
MetaTableAccessor.getMetaKeyForRegion(RegionInfoBuilder.FIRST_META_REGIONINFO);

Review comment:
       Yes, just like what we have done for normal regions which are stored in 
meta table.
   
   I think we should change the class and method name, as francis suggested. 
Can be done in another issue.




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


Reply via email to