frostruan commented on a change in pull request #4115:
URL: https://github.com/apache/hbase/pull/4115#discussion_r814902123



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
##########
@@ -1214,11 +1358,27 @@ public void initialize(MasterServices master, 
MetricsMaster metricsMaster) throw
 
     this.coordinator = new ProcedureCoordinator(comms, tpool, timeoutMillis, 
wakeFrequency);
     this.executorService = master.getExecutorService();
+    this.verifyWorkerAssigner = new WorkerAssigner(master,
+      conf.getInt("hbase.snapshot.verify.task.max", 3),
+      new ProcedureEvent<>("snapshot-verify-worker-assigning"));
+    restoreUnfinishedSnapshotProcedure();
+    restoreWorkers();
     resetTempDir();
     snapshotHandlerChoreCleanerTask =
         scheduleThreadPool.scheduleAtFixedRate(this::cleanupSentinels, 10, 10, 
TimeUnit.SECONDS);
   }
 
+  private void restoreUnfinishedSnapshotProcedure() {

Review comment:
       Yes. I also think that it is the most elegant way to restore the procid 
in afterReplay method, but because of the startup order of master, there will 
be a NPE problem if we do that.
   
   We can see the startup order in HMaster#finishActiveMasterInitialization().
   1. we replay procedures in the method HMaster#createProcedureExecutor()
   2. we create the snapshot manager instance in the method 
HMaster#initializeZKBasedSystemTrackers()
   3. we start the procedure executor in the method 
HMaster#startServiceThreads()
   Since these three method are executed in the same thread, so I think it's 
safe here.




-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to