Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-11587 Fix memory estimates for mapjoin hashtable
  3. HIVE-11467

WriteBuffers rounding wbSize to next power of 2 may cause OOM

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0, 2.0.0
    • 1.3.0, 2.0.0
    • Hive
    • None

    Description

      If wbSize passed to WriteBuffers cstr is not power of 2, it will do a rounding first to the next power of 2

        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();
        }
      

      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.

      Attachments

        1. HIVE-11467.01.patch
          0.9 kB
          Wei Zheng
        2. HIVE-11467.02.patch
          0.9 kB
          Wei Zheng
        3. HIVE-11467.03.patch
          2 kB
          Wei Zheng
        4. HIVE-11467.04.patch
          2 kB
          Wei Zheng

        Activity

          People

            wzheng Wei Zheng
            wzheng Wei Zheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: