priyankporwal commented on a change in pull request #678: PHOENIX-5644 and 
PHOENIX-5651 addendum patch
URL: https://github.com/apache/phoenix/pull/678#discussion_r365981964
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
 ##########
 @@ -424,20 +424,21 @@ private void 
enableImmutableTables(ConnectionQueryServices queryServices,
             long startWaitTime) {
         long endWaitTime = EnvironmentEdgeManager.currentTimeMillis();
         long waitMore = getWaitMoreTime(endWaitTime, startWaitTime);
-        while (waitMore>0) {
+        while (waitMore>0 && !isWaitComplete) {
             // If the table is immutable, we need to wait for clients to purge
             // their caches of table metadata
             LOGGER.info("waiting for more " + waitMore + " ms for client cache 
"
                     + "to expire for immutable tables");
             try {
                 startWaitTime = EnvironmentEdgeManager.currentTimeMillis();
                 Thread.sleep(waitMore);
-                waited = true;
+                isWaitComplete = true;
             } catch (InterruptedException e) {
                 endWaitTime = EnvironmentEdgeManager.currentTimeMillis();
 
 Review comment:
   @swaroopak This logic of splitting endWaitTime and startWaitTime and two 
booleans is getting more bug prone now. 
   I would suggest the below reorg
   while(true) { 
   long endWaitTime = EnvironmentEdgeManager.currentTimeMillis();
   long waitMore = getWaitMoreTime(endWaitTime, startWaitTime);
   if (waitMore <= 0) 
   {
   isWaitComplete = true; break;
   }
   try {
   Thread.sleep(waitMore);
   isWaitComplete = true;
   }
   catch((InterruptedException e) {
   LOGGER.warning("Sleep before starting index rebuild is interrupted. "
                           + "Attempting to sleep again! " + e.getMessage());
   }
   }

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


With regards,
Apache Git Services

Reply via email to