thomasmueller commented on a change in pull request #406:
URL: https://github.com/apache/jackrabbit-oak/pull/406#discussion_r741681015



##########
File path: 
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
##########
@@ -488,6 +488,14 @@ public void close() {
 
     private void runWhenPermitted() {
         if (indexStats.isPaused()) {
+            if (indexStats.forcedLeaseRelease){
+                try {
+                    clearLease();
+                } catch (CommitFailedException e) {
+                    log.warn("Unable to release lease, please try again");

Review comment:
       Please log the exception (message and stack trace):
   
       log.warn("Unable to release lease, please try again", e);
   

##########
File path: 
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
##########
@@ -626,6 +634,22 @@ private void runWhenPermitted() {
         }
     }
 
+    private void clearLease() throws CommitFailedException {
+        NodeState root = store.getRoot();
+        NodeState async = root.getChildNode(ASYNC);
+        String beforeCheckpoint = async.getString(name);
+        if (async.hasProperty(leasify(name))) {
+            NodeBuilder builder = root.builder();
+            builder.child(ASYNC).removeProperty(leasify(name));
+            mergeWithConcurrencyCheck(store, validatorProviders,
+                    builder, beforeCheckpoint, null, name);
+            log.debug("Lease property removed for lane: {}", name);

Review comment:
       I would use log.info in this method (both cases), it is not called that 
often.

##########
File path: 
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
##########
@@ -626,6 +634,22 @@ private void runWhenPermitted() {
         }
     }
 
+    private void clearLease() throws CommitFailedException {
+        NodeState root = store.getRoot();
+        NodeState async = root.getChildNode(ASYNC);
+        String beforeCheckpoint = async.getString(name);
+        if (async.hasProperty(leasify(name))) {
+            NodeBuilder builder = root.builder();
+            builder.child(ASYNC).removeProperty(leasify(name));

Review comment:
       I would call leasify(name) only once.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to