virajjasani commented on a change in pull request #1286: HBASE-23977 : Resolve 
flakes present in TestSlowLogRecorder
URL: https://github.com/apache/hbase/pull/1286#discussion_r394126999
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/slowlog/TestSlowLogRecorder.java
 ##########
 @@ -140,12 +141,16 @@ public void testOnlieSlowLogConsumption() throws 
Exception {
     Assert.assertNotEquals(-1, HBASE_TESTING_UTILITY.waitFor(3000,
       () -> slowLogRecorder.getSlowLogPayloads(request).size() == 7));
 
-    slowLogPayloads = slowLogRecorder.getSlowLogPayloads(request);
-
-    Assert.assertEquals(slowLogPayloads.size(), 7);
-    confirmPayloadParams(0, 7, slowLogPayloads);
-    confirmPayloadParams(5, 2, slowLogPayloads);
-    confirmPayloadParams(6, 1, slowLogPayloads);
+    Assert.assertNotEquals(-1, HBASE_TESTING_UTILITY.waitFor(3000,
+      () -> {
+        List<SlowLogPayload> slowLogPayloadsList = 
slowLogRecorder.getSlowLogPayloads(request);
+        Assert.assertEquals(slowLogPayloadsList.size(), 7);
+        boolean b1 = confirmPayloadParams(0, 7, slowLogPayloadsList);
 
 Review comment:
   e.g if we send {1,2,3,4,5,6,7} to RingBuffer of size 8, then all of them are 
consumed in same order. Now if we send {8,9,10,11}, we expect final output from 
RingBuffer consumer to be {9,10,11,4,5,6,7,8}  (1,2,3 are overridden). However, 
the reason why we have flakes is because by the time we expect above output, 
consumer might not have consumed say 10 and 11 and hence actual output would be 
{9,2,3,4,5,6,7,8}. And hence the failures, so now with waitFor(), we wait until 
we get ordered output {9,10,11,4,5,6,7,8}, which is why we will wait for all of 
8,9,10,11 to be consumed and put in the queue in correct order i.e. no flakes.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to