pnowojski commented on a change in pull request #7911: [FLINK-11082][network] 
Fix the logic of getting backlog in sub partition
URL: https://github.com/apache/flink/pull/7911#discussion_r265985944
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionView.java
 ##########
 @@ -147,7 +147,8 @@ public BufferAndBacklog getNextBuffer() throws 
IOException, InterruptedException
                        return null;
                }
 
-               int newBacklog = 
parent.decreaseBuffersInBacklog(current.isBuffer());
+               parent.decreaseBuffersInBacklog(current.isBuffer());
+               int newBacklog = parent.getBuffersInBacklog();
 
 Review comment:
   I think that option 1. even if it's correct right now, would be more error 
prone for the future. Forcing every contributor/committer in this part to 
rethink this contract/dependencies every time is not a good thing to do.
   
   For example, as you if the backlog increases between those two calls there 
is no problem, however it takes some time to realize about this fact. Also 
currently I'm not sure if the backlog can be somehow decreased by a 3rd party 
(another thread) betwen those two calls and if that happens, if that's ok? 
Another question, are all of the arithmetic operations on the backlog atomic? 
   
   Long story short, if we can avoid think about the above issues, so much the 
better - I would pick number 2.

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