[ 
https://issues.apache.org/jira/browse/DRILL-3811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14901358#comment-14901358
 ] 

ASF GitHub Bot commented on DRILL-3811:
---------------------------------------

Github user cwestin commented on a diff in the pull request:

    https://github.com/apache/drill/pull/163#discussion_r40023098
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java 
---
    @@ -63,6 +63,29 @@
       private final static String planFile="/physical_allocator_test.json";
     
       @Test
    +  public void testTransfer() throws Exception {
    +    final Properties props = new Properties() {
    +      {
    +        put(ExecConstants.TOP_LEVEL_MAX_ALLOC, "1000000");
    +        put(ExecConstants.ERROR_ON_MEMORY_LEAK, "true");
    +      }
    +    };
    +    final DrillConfig config = DrillConfig.create(props);
    +    BufferAllocator a = new TopLevelAllocator(config);
    --- End diff --
    
    I was surprised this compiled; in one of my recent patches, I had removed 
the "public" from TopLevelAllocator, but it seems to have come back. It was 
removed to force people to use RootAllocatorFactory.newRoot() instead of using 
the TopLevelAllocator constructor directly. Can you please remove the public 
from TopLevelAllocator again, and replace this constructor here and on the next 
line with RootAllocatorFactory.newRoot()?


> AtomicRemainder incorrectly accounts for transferred allocations
> ----------------------------------------------------------------
>
>                 Key: DRILL-3811
>                 URL: https://issues.apache.org/jira/browse/DRILL-3811
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Relational Operators
>            Reporter: Deneche A. Hakim
>            Assignee: Chris Westin
>         Attachments: DRILL-3811.1.patch.txt
>
>
> when an allocator takes ownership of a buffer, AtomicRemainder.forceGet(int) 
> is called to account for the extra memory of the buffer, but when the 
> allocator exceeds it's maximum allocated memory it accounts for it 
> incorrectly. In the following code, {{availableShared.andAndGet(size)}} 
> should actually receive {{-size}}:
> {code}
> public boolean forceGet(long size) {
>     if (get(size, this.applyFragmentLimit)) {
>       return true;
>     } else {
>       availableShared.addAndGet(size);
>       if (parent != null) {
>         parent.forceGet(size);
>       }
>       return false;
>     }
>   }
> {code}
> I was able to reproduce the issue in a simple unit test



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to