steveloughran commented on code in PR #1240:
URL: https://github.com/apache/parquet-mr/pull/1240#discussion_r1468508122


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/MemoryManager.java:
##########
@@ -74,7 +75,7 @@ private void checkRatio(float ratio) {
    * @param writer     the new created writer
    * @param allocation the requested buffer size
    */
-  synchronized void addWriter(InternalParquetRecordWriter<?> writer, Long 
allocation) {
+  void addWriter(InternalParquetRecordWriter<?> writer, Long allocation) {
     Long oldValue = writerList.get(writer);
     if (oldValue == null) {

Review Comment:
   putIfAbsent() and only update the allocation if it was put in the map? It's 
probably that allocation code which is holding on to the lock for so long. But: 
that `updateAllocation()` operation is possibly the slow part -and it now has 
to be thread safe if the callers are no longer locked



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