You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/06/03 22:45:50 UTC

[orc] branch main updated: ORC-803: MemoryManagerImpl Simplify removeWriter (#704)

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 46d2bdc  ORC-803: MemoryManagerImpl Simplify removeWriter (#704)
46d2bdc is described below

commit 46d2bdc568632b699892dc3e1d1684bd9d68f63d
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Thu Jun 3 18:45:42 2021 -0400

    ORC-803: MemoryManagerImpl Simplify removeWriter (#704)
    
    ### What changes were proposed in this pull request?
    Within the class MemoryManagerImpl, removing a writer can be simplified down to a single Map interaction.
    
    ### Why are the changes needed?
    Change reduces code size and allows the Map to be scanned only one time instead of twice (in some scenarios).
    
    
    ### How was this patch tested?
    Existing unit tests
---
 java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java b/java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java
index b5141b7..f3e33e9 100644
--- a/java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java
@@ -100,9 +100,8 @@ public class MemoryManagerImpl implements MemoryManager {
    */
   @Override
   public synchronized void removeWriter(Path path) throws IOException {
-    WriterInfo val = writerList.get(path);
+    WriterInfo val = writerList.remove(path);
     if (val != null) {
-      writerList.remove(path);
       totalAllocation.addAndGet(-val.allocation);
     }
   }