wchevreuil commented on a change in pull request #4111:
URL: https://github.com/apache/hbase/pull/4111#discussion_r809487400



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java
##########
@@ -287,6 +303,39 @@ private static void replayWALs(Configuration conf, 
FileSystem walFs, Path walRoo
     }
   }
 
+  private static void tryMigrate(Configuration conf, FileSystem fs, Path 
tableDir,
+    RegionInfo regionInfo, TableDescriptor oldTd, TableDescriptor newTd) 
throws IOException {
+    Class<? extends StoreFileTracker> oldSft =
+      
StoreFileTrackerFactory.getTrackerClass(oldTd.getValue(StoreFileTrackerFactory.TRACKER_IMPL));
+    Class<? extends StoreFileTracker> newSft =
+      
StoreFileTrackerFactory.getTrackerClass(newTd.getValue(StoreFileTrackerFactory.TRACKER_IMPL));
+    if (oldSft.equals(newSft)) {
+      LOG.debug("old store file tracker {} is the same with new store file 
tracker, skip migration",
+        StoreFileTrackerFactory.getStoreFileTrackerName(oldSft));
+      if (!oldSft.equals(newSft)) {
+        // we may change other things such as adding a new family, so here we 
still need to persist
+        // the new table descriptor
+        LOG.info("Update table descriptor from {} to {}", oldTd, newTd);
+        FSTableDescriptors.createTableDescriptorForTableDirectory(fs, 
tableDir, newTd, true);
+      }

Review comment:
       I believe this block is never reached.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionFactory.java
##########
@@ -89,10 +94,23 @@
       .setDataBlockEncoding(DataBlockEncoding.ROW_INDEX_V1).build())
     .setColumnFamily(ColumnFamilyDescriptorBuilder.of(PROC_FAMILY)).build();
 
+  private static TableDescriptor withTrackerConfigs(Configuration conf) {
+    String trackerImpl = conf.get(TRACKER_IMPL, 
conf.get(StoreFileTrackerFactory.TRACKER_IMPL,
+      StoreFileTrackerFactory.Trackers.DEFAULT.name()));
+    Class<? extends StoreFileTracker> trackerClass =
+      StoreFileTrackerFactory.getTrackerClass(trackerImpl);
+    if (StoreFileTrackerFactory.isMigration(trackerClass)) {
+      throw new IllegalArgumentException("Should not set store file tracker to 
" +
+        StoreFileTrackerFactory.Trackers.MIGRATION.name() + " for master local 
region");
+    }
+    StoreFileTracker tracker = ReflectionUtils.newInstance(trackerClass, conf, 
true, null);
+    return 
tracker.updateWithTrackerConfigs(TableDescriptorBuilder.newBuilder(TABLE_DESC)).build();
+  }

Review comment:
       Could maybe go to one of the SFT related classes, like the SFT Factory 
or the SFT validations util? I think we had already done some similar 
validation elsewhere.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to