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

Vikas Saurabh commented on OAK-4912:
------------------------------------

Btw, here's a hint (sorry couldn't investigate further). Doing this
{noformat}
diff --git 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/ReplicaSetInfo.java
 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/ReplicaSetInfo.java
index abeba8a..4f95691 100644
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/ReplicaSetInfo.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/ReplicaSetInfo.java
@@ -158,6 +158,10 @@ public class ReplicaSetInfo implements Runnable {
                     break;
                 }
             }
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+            }
         }
         LOG.debug("Stopping the replica set info");
         nodeCollections.close();
{noformat}
made the test for me once (and the test was excruciatingly slow). Subsequently, 
for some reason, it seemed that sleep wasn't working anymore. So, I added a 
breakpoint at Thread.sleep to almost immediately continue it and the thread 
failed every time.

I know this is very hacky but probably does indeed show some dependence on 
thread scheduling. Hope it helps though.

> MongoDB: ReadPreferenceIT.testMongoReadPreferencesForLocalChanges() 
> occasionally fails
> --------------------------------------------------------------------------------------
>
>                 Key: OAK-4912
>                 URL: https://issues.apache.org/jira/browse/OAK-4912
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, mongomk
>            Reporter: Julian Reschke
>            Assignee: Tomek Rękawek
>            Priority: Minor
>
> {noformat}
> testMongoReadPreferencesForLocalChanges(org.apache.jackrabbit.oak.plugins.document.mongo.ReadPreferenceIT)
>   Time elapsed: 0.024 sec  <<< FAILURE!
> java.lang.AssertionError: expected:<secondary> but was:<primary>
>         at org.junit.Assert.fail(Assert.java:88)
>         at org.junit.Assert.failNotEquals(Assert.java:834)
>         at org.junit.Assert.assertEquals(Assert.java:118)
>         at org.junit.Assert.assertEquals(Assert.java:144)
>         at 
> org.apache.jackrabbit.oak.plugins.document.mongo.ReadPreferenceIT.testMongoReadPreferencesForLocalChanges(ReadPreferenceIT.java:195)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to