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

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

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/840#discussion_r123129202
  
    --- Diff: 
exec/memory/base/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java ---
    @@ -174,6 +175,40 @@ public ByteBuf setDouble(int index, double value) {
         return this;
       }
     
    +  // Clone of the super class checkIndex, but this version returns a 
boolean rather
    +  // than throwing an exception.
    +
    +  protected boolean hasCapacity(int index, int fieldLength) {
    +    if (fieldLength < 0) {
    +        throw new IllegalArgumentException("length: " + fieldLength + " 
(expected: >= 0)");
    +    }
    +    return (! (index < 0 || index > capacity() - fieldLength));
    +  }
    +
    +  // Clone of the super class setBytes(), but with bounds checking done as 
a boolean,
    +  // not assertion.
    +
    +  public boolean setBytesBounded(int index, byte[] src, int srcIndex, int 
length) {
    +    if (! hasCapacity(index, length)) {
    +      return false;
    +    }
    +    if (length != 0) {
    --- End diff --
    
    Fixed


> Provide size-aware set operations in value vectors
> --------------------------------------------------
>
>                 Key: DRILL-5517
>                 URL: https://issues.apache.org/jira/browse/DRILL-5517
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.11.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>             Fix For: 1.11.0
>
>
> DRILL-5211 describes a memory fragmentation issue in Drill. The resolution is 
> to limit vector sizes to 16 MB (the size of Netty memory allocation "slabs.") 
> Effort starts by providing "size-aware" set operations in value vectors which:
> * Operate as {{setSafe()}} while vectors are below 16 MB.
> * Throw a new, specific exception ({{VectorOverflowException}}) if setting 
> the value (and growing the vector) would exceed the vector limit.
> The methods in value vectors then become the foundation on which we can 
> construct size-aware record batch "writers."



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to