[ 
https://issues.apache.org/jira/browse/OAK-8089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16783458#comment-16783458
 ] 

Julian Reschke commented on OAK-8089:
-------------------------------------

Patch committed without slow running repro test:

{noformat}
Index: 
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
===================================================================
--- 
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
      (revision 1854756)
+++ 
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
      (working copy)
@@ -3657,6 +3657,35 @@
         after.compareAgainstBaseState(before, new DefaultNodeStateDiff());
     }
 
+    // OAK-8089
+    @Test
+    public void slowDispose() throws Exception {
+        final Clock clock = Clock.SIMPLE;
+        final AtomicBoolean disposing = new AtomicBoolean(false);
+        DocumentStore docStore = new MemoryDocumentStore() {
+            @Nullable
+            @Override
+            public <T extends Document> T findAndUpdate(Collection<T> 
collection, UpdateOp update) {
+                // if this is a write access to the root node, and we have
+                // started disposing: suspend until lease time out
+                if (disposing.get() && collection == Collection.NODES && 
"0:/".equals(update.getId())) {
+                    long until = clock.getTime() + 1000 + 
ClusterNodeInfo.DEFAULT_LEASE_DURATION_MILLIS;
+                    while (clock.getTime() < until) {
+                        try {
+                            clock.waitUntil(until);
+                        } catch (InterruptedException ex) {
+                        }
+                    }
+                }
+                return super.findAndUpdate(collection, update);
+            }
+        };
+        DocumentNodeStore store = 
builderProvider.newBuilder().clock(clock).setDocumentStore(docStore).getNodeStore();
+
+        disposing.set(true);
+        store.dispose();
+    }
+
     // OAK-2621
     @Test
     public void getChildNodeCount() throws Exception {
{noformat}

> DocumentNodeStore dispose can fail when duration of final background ops 
> exceeds lease time
> -------------------------------------------------------------------------------------------
>
>                 Key: OAK-8089
>                 URL: https://issues.apache.org/jira/browse/OAK-8089
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: documentmk
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>              Labels: candidate_oak_1_10
>             Fix For: 1.12, 1.11.0
>
>         Attachments: OAK-8089.diff, OAK-8089.diff, oak-8089.patch
>
>
> The problem is that {{dispose()}} let's the {{BackgroundLeaseUpdateThread}} 
> run once.
> If the duration of the remaining operations then exceeds the lease update 
> interval, these operations will fail with a {{DocumentStoreException}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to