zuston commented on code in PR #811:
URL: https://github.com/apache/incubator-uniffle/pull/811#discussion_r1163529172


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/writer/WriteBufferManager.java:
##########
@@ -173,25 +174,27 @@ public List<ShuffleBlockInfo> addRecord(int partitionId, 
Object key, Object valu
       return null;
     }
     List<ShuffleBlockInfo> result = Lists.newArrayList();
-    if (buffers.containsKey(partitionId)) {
-      WriterBuffer wb = buffers.get(partitionId);
-      if (wb.askForMemory(serializedDataLength)) {
+    synchronized (buffers) {

Review Comment:
   The invoking number of `addRecord` is greater than the `clear` invoking 
number. So we'd better to reduce the lock number of `addRecord`. But we should 
ensure the `WriteBuffer` thread safe.



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