caroliney14 commented on a change in pull request #2769:
URL: https://github.com/apache/hbase/pull/2769#discussion_r600052545



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java
##########
@@ -176,7 +176,7 @@ private void testSanity(final String testName) throws 
Exception {
   @Test
   public void testRegionAssignmentAfterMasterRecoveryDueToZKExpiry() throws 
Exception {
     MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
-    cluster.startRegionServer();
+    cluster.startRegionServerAndWait(2000);

Review comment:
       sorry, I meant to say "If online for a regionserver should mean that the 
regionserver has communicated to master it's ready to be assigned regions, then 
online should be set after the first `tryRegionServerReport`," since `online` 
is currently being set in `handleReportForDuty`, after `reportForDuty` finishes 
(see [this 
line](https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java#L1657-L1660)).
 if we agree on this semantic, then I'll make the change, within [this 
block](https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java#L1053-L1087).
 it would look something like this:
   
   ```
         // Run mode.
         long lastMsg = System.currentTimeMillis();
         long oldRequestCount = -1;
         boolean firstReport = true;
         // The main run loop.
         while (!isStopped() && isHealthy()) {
         ...
         long now = System.currentTimeMillis();
           if ((now - lastMsg) >= msgInterval) {
             // Register with the Master now that our setup is complete.
             tryRegionServerReport(lastMsg, now);
             if (firstReport) {
               // Wake up anyone waiting for this server to online
               synchronized (online) {
                 online.set(true);
                 online.notifyAll();
               }
               firstReport = false;
             }
             lastMsg = System.currentTimeMillis();
           }
           if (!isStopped() && !isAborted()) {
             this.sleeper.sleep();
           }
         ...
   ```




-- 
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:
[email protected]


Reply via email to