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 mr...@apache.org on 2016/09/08 14:03:16 UTC

svn commit: r1759826 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java

Author: mreutegg
Date: Thu Sep  8 14:03:16 2016
New Revision: 1759826

URL: http://svn.apache.org/viewvc?rev=1759826&view=rev
Log:
OAK-4779: ClusterNodeInfo may renew lease while recovery is running

Add ignored test.

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java?rev=1759826&r1=1759825&r2=1759826&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java Thu Sep  8 14:03:16 2016
@@ -109,11 +109,13 @@ public class ClusterNodeInfoTest {
         ClusterNodeInfo info = newClusterNodeInfo(1);
         clock.waitUntil(info.getLeaseEndTime() + ClusterNodeInfo.DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS);
         recoverClusterNode(1);
+        boolean renewed = false;
         try {
-            assertFalse(info.renewLease());
+            renewed = info.renewLease();
         } catch (AssertionError e) {
-            // TODO: expected !?
+            // TODO: rather use DocumentStoreException !?
         }
+        assertFalse(renewed);
         for (int i = 0; i < 10; i++) {
             if (handler.isLeaseFailure()) {
                 return;
@@ -123,6 +125,27 @@ public class ClusterNodeInfoTest {
         fail("expected lease failure");
     }
 
+    // OAK-4779
+    @Ignore
+    @Test
+    public void renewLeaseWhileRecoveryRunning() throws Exception {
+        ClusterNodeInfo info = newClusterNodeInfo(1);
+        // wait until after lease end
+        clock.waitUntil(info.getLeaseEndTime() + ClusterNodeInfo.DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS);
+        // simulate a started recovery
+        MissingLastRevSeeker seeker = new MissingLastRevSeeker(store.getStore(), clock);
+        assertTrue(seeker.acquireRecoveryLock(1, 42));
+        // cluster node 1 must not be able to renew the lease now
+        boolean renewed = false;
+        try {
+            // must either return false
+            renewed = info.renewLease();
+        } catch (AssertionError e) {
+            // or throw an exception
+        }
+        assertFalse(renewed);
+    }
+
     private void recoverClusterNode(int clusterId) throws Exception {
         DocumentNodeStore ns = new DocumentMK.Builder()
                 .setDocumentStore(store.getStore()) // use unwrapped store