zjf2012 commented on code in PR #480:
URL: https://github.com/apache/incubator-uniffle/pull/480#discussion_r1069124026


##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java:
##########
@@ -259,7 +259,7 @@ public SendShuffleDataResult sendShuffleData(String appId, 
List<ShuffleBlockInfo
     }
 
     // maintain the count of blocks that have been sent to the server
-    Map<Long, AtomicInteger> blockIdsTracker = Maps.newConcurrentMap();
+    Map<Long, AtomicInteger> blockIdsTracker = Maps.newHashMap();

Review Comment:
   I went through some logic and didn't find any update to "blockIdsTracker" 
(**correct me if I am wrong**) in main thread after "sendShuffleDataAsync" call 
which runs asynchronously in the threadpool, "dataTransferPool". According to  
[BlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/BlockingQueue.html
 ) (used internally by the thread pool), "...actions in a thread prior to 
placing an object into a BlockingQueue 
[happen-before](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/package-summary.html#MemoryVisibility)
 actions subsequent to the access or removal of that element from the 
BlockingQueue in another thread.". 
   
   So, I think we don't need cocurrentHashmap for "blockIdsTracker".  And you 
use "AtomicInteger" as value part of "blockIdsTracker", it's enough to make the 
updated value visible to other threads in later code. 
   
   
    



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to