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



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -1218,6 +1219,32 @@ private void 
finishActiveMasterInitialization(MonitoredTask status) throws IOExc
       LOG.debug("Balancer post startup initialization complete, took " + (
           (EnvironmentEdgeManager.currentTime() - start) / 1000) + " seconds");
     }
+
+    /*
+      A background thread to update all TableDescriptors that do not contain
+      StoreFileTracker implementation configuration. see HBASE-26263.
+    */
+    Thread STFChecking = new Thread(() -> {
+      try {
+        tableDescriptors.getAll().forEach((tableName, htd) -> {
+          if 
(StringUtils.isEmpty(htd.getValue(StoreFileTrackerFactory.TRACKER_IMPL))) {
+            TableDescriptorBuilder builder = 
TableDescriptorBuilder.newBuilder(htd);
+            StoreFileTrackerFactory.persistTrackerConfig(this.conf, builder);
+            try {
+              tableDescriptors.update(builder.build());
+              LOG.info("Persist StoreFileTracker configurations to 
TableDescriptor for table {}",
+                tableName);
+            } catch (IOException ioe) {
+              LOG.warn("Failed to persist StoreFileTracker to table {}", 
tableName, ioe);
+            }
+          }
+        });
+      } catch (IOException e) {
+        LOG.error("Failed to run StoreFileTracker checking thread for existing 
tables!", e);
+      }
+    }, "StoreFileTrackerChecking");
+    STFChecking.setDaemon(true);
+    STFChecking.start();

Review comment:
       This may cause too many threads to be submitted at once during 
initialisation, on clusters with many tables. And could we have some  sort of 
"rolling-upgrade" to be set that would trigger this code, instead of doing this 
within every master initialization? I guess even if we do refactor this to be 
run as procedures, it would be worth avoid unnecessary runs. 




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