tillrohrmann commented on a change in pull request #9242: 
[FLINK-13408][runtime] Schedule 
StandaloneResourceManager.setFailUnfulfillableRequest whenever the leadership 
is acquired
URL: https://github.com/apache/flink/pull/9242#discussion_r308268973
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/StandaloneResourceManagerTest.java
 ##########
 @@ -83,6 +83,24 @@ public void testNoStartupPeriod() throws Exception {
                rm.close();
        }
 
+       @Test
+       public void testStartUpPeriodAfterLeadershipSwitch() throws Exception {
+               final TestingStandaloneResourceManager rm = 
createResourceManager(Time.milliseconds(1L));
+
+               final Deadline deadline1 = 
Deadline.fromNow(Duration.ofSeconds(10L));
+               assertHappensUntil(() -> 
rm.isFailingUnfulfillableRequestAsync().join(), deadline1);
+
+               rm.rmServices.revokeLeadership();
+
+               final Deadline deadline2 = 
Deadline.fromNow(Duration.ofSeconds(10L));
+               assertHappensUntil(() -> 
!rm.rmServices.slotManager.isFailingUnfulfillableRequest(), deadline2);
 
 Review comment:
   This pattern is problematic. We are accessing state of the `SlotManager` 
which is owned by the `ResourceManager` and which should only be accessed from 
the `RpcEndpoint's` main thread. Otherwise we might run into visibility issues. 
I would suggest to rather test the behaviour of the RM via its public API 
instead of inspecting its internal state.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to