Details
-
Bug
-
Resolution: Done
-
Major
-
9.0.0.Alpha4
Description
CacheClusterJoinTest.testIsCoordinator assumes that once JGroupsTransport received a view, JGroupsTransport.isCoordinator() returns the correct value.
However, only JGroupsTransfer.viewAccepted is synchronized, isCoordinator() is not, so the main thread can see isCoordinator() == false even after getMembers().get(0) == self.
19:32:27,555 DEBUG (Incoming-1,Test-NodeD-36891:[]) [JGroupsTransport] New view accepted: [Test-NodeD-36891|2] (1) [Test-NodeD-36891] 19:32:27,556 ERROR (testng-Test:[]) [TestSuiteProgress] Test failed: org.infinispan.api.CacheClusterJoinTest.testIsCoordinator java.lang.AssertionError at org.infinispan.api.CacheClusterJoinTest.testIsCoordinator(CacheClusterJoinTest.java:65) ~[test-classes/:?] 19:32:27,555 DEBUG (Incoming-1,Test-NodeD-36891:[]) [JGroupsTransport] Joined: [], Left: [Test-NodeC-35712]
It would be nice if isCoordinator(), getCoordinator(), and getMembers() were more in sync, even though the view can always change between two calls. The simplest way to do this would be to implement isCoordinator() and getCoordinator() on top of getMembers() and remove their fields, since they're not use in performance-sensitive code.