Author: reschke
Date: Fri Apr 28 18:23:43 2017
New Revision: 1793122

URL: http://svn.apache.org/viewvc?rev=1793122&view=rev
Log:
OAK-5886: Confusing log message from lease update (ported to 1.6)

Modified:
    jackrabbit/oak/branches/1.6/   (props changed)
    
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java

Propchange: jackrabbit/oak/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 28 18:23:43 2017
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784130,1784162,1784251,1784401,1784551,1784574,1785095,1785108,1785283,1785838,1785919,1787074,1787217,1788378,1790382,1792463,1792742,1793088
+/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784130,1784162,1784251,1784401,1784551,1784574,1785095,1785108,1785283,1785838,1785919,1785946,1787074,1787217,1788378,1790382,1792463,1792742,1793088
 /jackrabbit/trunk:1345480

Modified: 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java?rev=1793122&r1=1793121&r2=1793122&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
 (original)
+++ 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
 Fri Apr 28 18:23:43 2017
@@ -676,7 +676,7 @@ public class ClusterNodeInfo {
                 // someone else won and marked leaseCheckFailed - so we only 
log/throw
                 throw leaseExpired(LEASE_CHECK_FAILED_MSG, true);
             }
-            for(int i=0; i<MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE; i++) {
+            for (int i = 0; i < MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE; i++) {
                 now = getCurrentTime();
                 if (now < (leaseEndTime - leaseFailureMargin)) {
                     // if lease is OK here, then there was a race
@@ -703,13 +703,20 @@ public class ClusterNodeInfo {
                 // as the margin is 20sec and we're just reducing it by 5sec
                 // (in the un-paused case)
                 try {
-                    LOG.info("performLeaseCheck: lease within 
"+leaseFailureMargin+
-                            "ms of failing ("+(leaseEndTime-now)+" ms 
precisely) - "
-                            + "waiting 1sec to retry (up to another "+
-                            (MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE-1-i)+" 
times)...");
-                    wait(1000); // directly use this to sleep on - to allow 
renewLease() to work
+                    long difference = leaseEndTime - now;
+                    long waitForMs = 1000;
+
+                    String detail = difference >= 0
+                            ? String.format("lease within %dms of failing 
(%dms precisely)", leaseFailureMargin, difference)
+                            : String.format("already past lease end (%dms 
precisely)", -1 * difference);
+                    String retries = String.format("waiting %dms to retry (up 
to another %d times...)", waitForMs,
+                            MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE - 1 - i);
+                    LOG.info("performLeaseCheck: " + detail + " - " + retries);
+
+                    // directly use this to sleep on - to allow renewLease() 
to work
+                    wait(waitForMs);
                 } catch (InterruptedException e) {
-                    LOG.warn("performLeaseCheck: got interrupted - giving up: 
"+e, e);
+                    LOG.warn("performLeaseCheck: got interrupted - giving up: 
" + e, e);
                     break;
                 }
             }


Reply via email to