TanYuxin-tyx commented on a change in pull request #17936:
URL: https://github.com/apache/flink/pull/17936#discussion_r782805436



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/disk/BatchShuffleReadBufferPoolTest.java
##########
@@ -98,6 +98,34 @@ public void testRecycle() throws Exception {
         assertEquals(bufferPool.getNumTotalBuffers(), 
bufferPool.getAvailableBuffers());
     }
 
+    @Test
+    public void testBufferOperationTimestampUpdated() throws Exception {
+        BatchShuffleReadBufferPool bufferPool = new 
BatchShuffleReadBufferPool(1024, 1024);
+        long oldTimestamp = bufferPool.getLastBufferOperationTimestamp();
+        List<MemorySegment> buffers = bufferPool.requestBuffers();
+        assertEquals(1, buffers.size());
+        long nowTimestamp = bufferPool.getLastBufferOperationTimestamp();
+        // The timestamp is updated when requesting buffers successfully
+        assertTrue(nowTimestamp > oldTimestamp);
+        assertEquals(nowTimestamp, 
bufferPool.getLastBufferOperationTimestamp());
+
+        oldTimestamp = nowTimestamp;
+        bufferPool.recycle(buffers);

Review comment:
       OK, Fixed it.

##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/disk/BatchShuffleReadBufferPoolTest.java
##########
@@ -98,6 +98,34 @@ public void testRecycle() throws Exception {
         assertEquals(bufferPool.getNumTotalBuffers(), 
bufferPool.getAvailableBuffers());
     }
 
+    @Test
+    public void testBufferOperationTimestampUpdated() throws Exception {
+        BatchShuffleReadBufferPool bufferPool = new 
BatchShuffleReadBufferPool(1024, 1024);
+        long oldTimestamp = bufferPool.getLastBufferOperationTimestamp();
+        List<MemorySegment> buffers = bufferPool.requestBuffers();

Review comment:
       OK, Fixed it.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to