[ https://issues.apache.org/jira/browse/DRILL-4134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036869#comment-15036869 ]
ASF GitHub Bot commented on DRILL-4134: --------------------------------------- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/283#discussion_r46493263 --- Diff: exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java --- @@ -230,20 +249,31 @@ public synchronized boolean release() { */ @Override public synchronized boolean release(int decrement) { + if (isEmpty) { + return false; + } - if(rootBuffer){ - final long newRefCnt = this.rootRefCnt.addAndGet(-decrement); - Preconditions.checkArgument(newRefCnt > -1, "Buffer has negative reference count."); - if (newRefCnt == 0) { - b.release(decrement); - acct.release(this, length); - return true; - }else{ - return false; - } - }else{ - return b.release(decrement); + if (decrement < 1) { + throw new IllegalStateException(String.format("release(%d) argument is not positive. Buffer Info: %s", + decrement, toVerboseString())); } + + if (BaseAllocator.DEBUG) { + historicalLog.recordEvent("release(%d)", decrement); --- End diff -- I think it would be helpful to also record the new `refCnt` > Incorporate remaining patches from DRILL-1942 Allocator refactor > ---------------------------------------------------------------- > > Key: DRILL-4134 > URL: https://issues.apache.org/jira/browse/DRILL-4134 > Project: Apache Drill > Issue Type: Sub-task > Components: Execution - Flow > Reporter: Jacques Nadeau > Assignee: Jacques Nadeau > Fix For: 1.4.0 > > -- This message was sent by Atlassian JIRA (v6.3.4#6332)