Author: reschke
Date: Mon Dec  3 17:32:48 2018
New Revision: 1848073

URL: http://svn.apache.org/viewvc?rev=1848073&view=rev
Log:
OAK-7935: RDB*Store: createOrUpdate may fail on stale cache when document was 
removed on different instance (just the test which passes on trunk)

Modified:
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java?rev=1848073&r1=1848072&r2=1848073&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
 Mon Dec  3 17:32:48 2018
@@ -228,6 +228,36 @@ public class MultiDocumentStoreTest exte
     }
 
     @Test
+    public void testUpdateRemovedNode() {
+        String id = Utils.getIdFromPath("testUpdateRemovedNode");
+        removeMe.add(id);
+
+        UpdateOp op = new UpdateOp(id, true);
+        assertNull(ds1.createOrUpdate(Collection.NODES, op));
+        // get it into the cache
+        NodeDocument n = ds1.find(Collection.NODES, id);
+        assertNotNull(n);
+
+        // delete it through the other instance
+        ds2.remove(Collection.NODES, Collections.singletonList(id));
+
+        // assume still in the cache?
+        NodeDocument n2 = ds1.find(Collection.NODES, id);
+        assertNotNull(n2);
+
+        // create-or-update should at least work after one retry
+        // see OAK-7953 - note that the retry shouldn't be needed; see OAK-7745
+        // for more information
+        try {
+            UpdateOp op2 = new UpdateOp(id, true);
+            assertNull(ds1.createOrUpdate(Collection.NODES, op2));
+        } catch (DocumentStoreException ex) {
+            UpdateOp op2 = new UpdateOp(id, true);
+            assertNull(ds1.createOrUpdate(Collection.NODES, op2));
+        }
+    }
+
+    @Test
     public void testUpdateOrCreateDeletedDocument() {
 
         String id = Utils.getIdFromPath("/foo");


Reply via email to