xintongsong commented on code in PR #20904:
URL: https://github.com/apache/flink/pull/20904#discussion_r981159512
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/HsMemoryDataManager.java:
##########
@@ -99,6 +115,20 @@ public HsMemoryDataManager(
bufferCompressor,
this);
}
+ this.previousPoolSize = getPoolSize();
+ if (poolSizeCheckInterval > 0) {
+ poolSizeChecker.scheduleAtFixedRate(
+ () -> {
+ int currentPoolSize = getPoolSize();
+ if (previousPoolSize > currentPoolSize) {
+ callWithLock(() ->
spillStrategy.decideActionWithGlobalInfo(this));
+ }
+ previousPoolSize = currentPoolSize;
Review Comment:
This is unsafe. The read/write of `previousPoolSize` is not atomic.
I think it would be fine to use an AtomicInteger. The cost should not be
high, as it's accessed only from the checking thread and from inside
`decideActionWithGlobalInfo`.
--
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]