Wei Zheng created HIVE-11467:
--------------------------------

             Summary: WriteBuffers rounding wbSize to next power of 2 may cause 
OOM
                 Key: HIVE-11467
                 URL: https://issues.apache.org/jira/browse/HIVE-11467
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 1.2.0, 2.0.0
            Reporter: Wei Zheng
            Assignee: Wei Zheng


If wbSize passed to WriteBuffers cstr is not power of 2, it will do a rounding 
first to the next power of 2
{code}
  public WriteBuffers(int wbSize, long maxSize) {
    this.wbSize = Integer.bitCount(wbSize) == 1 ? wbSize : 
(Integer.highestOneBit(wbSize) << 1);
    this.wbSizeLog2 = 31 - Integer.numberOfLeadingZeros(this.wbSize);
    this.offsetMask = this.wbSize - 1;
    this.maxSize = maxSize;
    writePos.bufferIndex = -1;
    nextBufferToWrite();
  }
{code}
That may break existing memory consumption assumption for mapjoin, and 
potentially cause OOM.

The solution will be to pass a power of 2 number as wbSize from upstream during 
hashtable creation, to avoid this late expansion.



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

Reply via email to