You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2016/03/10 16:19:00 UTC
svn commit: r1734424 - in /jackrabbit/oak/branches/1.4: ./
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
Author: reschke
Date: Thu Mar 10 15:18:57 2016
New Revision: 1734424
URL: http://svn.apache.org/viewvc?rev=1734424&view=rev
Log:
OAK-4100: ClusterNodeInfo lease renewal: add DEBUG level logging (ported to 1.4)
Modified:
jackrabbit/oak/branches/1.4/ (props changed)
jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
Propchange: jackrabbit/oak/branches/1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 10 15:18:57 2016
@@ -1,3 +1,3 @@
/jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1733875,1734254
+/jackrabbit/oak/trunk:1733875,1734230,1734254
/jackrabbit/trunk:1345480
Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java?rev=1734424&r1=1734423&r2=1734424&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java (original)
+++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java Thu Mar 10 15:18:57 2016
@@ -738,18 +738,20 @@ public class ClusterNodeInfo {
now = getCurrentTime();
leaseEndTime = now + leaseTime;
}
+
UpdateOp update = new UpdateOp("" + id, false);
update.set(LEASE_END_KEY, leaseEndTime);
update.set(STATE, ClusterNodeState.ACTIVE.name());
- ClusterNodeInfoDocument doc = null;
- if (renewed && !leaseCheckDisabled) { // if leaseCheckDisabled, then we just update the lease without checking
+
+ if (renewed && !leaseCheckDisabled) {
+ // if leaseCheckDisabled, then we just update the lease without
+ // checking
// OAK-3398:
// if we renewed the lease ever with this instance/ClusterNodeInfo
// (which is the normal case.. except for startup),
// then we can now make an assertion that the lease is unchanged
// and the incremental update must only succeed if no-one else
// did a recover/inactivation in the meantime
- update.setNew(false); // in this case it is *not* a new document
// make two assertions: the leaseEnd must match ..
update.equals(LEASE_END_KEY, null, previousLeaseEndTime);
// plus it must still be active ..
@@ -758,14 +760,14 @@ public class ClusterNodeInfo {
// yet another field to clusterNodes: a runtimeId that we
// create (UUID) at startup each time - and against that
// we could also check here - but that goes a bit far IMO
- doc = store.findAndUpdate(Collection.CLUSTER_NODES, update);
- } else {
- // this is only for startup - then we 'just' overwrite
- // the lease - or create it - and don't care a lot about what the
- // status of the lease was
- doc = store.findAndUpdate(Collection.CLUSTER_NODES, update);
}
- if (doc==null) { // should not occur when leaseCheckDisabled
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Renewing lease for for cluster id " + id + " with UpdateOp " + update);
+ }
+ ClusterNodeInfoDocument doc = store.findAndUpdate(Collection.CLUSTER_NODES, update);
+
+ if (doc == null) { // should not occur when leaseCheckDisabled
// OAK-3398 : someone else either started recovering or is already through with that.
// in both cases the local instance lost the lease-update-game - and hence
// should behave and must consider itself as 'lease failed'