Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-22496

UnsafeAccess.unsafeCopy should not copy more than UNSAFE_COPY_THRESHOLD on each iteration

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      In UnsafeAccess.unsafeCopy, we calculate a size _ to be read, no greater than UNSAFE_COPY_THRESHOLD, if total _len is larger than UNSAFE_COPY_THRESHOLD:

      long size = (len > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : len;
      

      But then we simply read the whole len anyway:

      theUnsafe.copyMemory(src, srcAddr, dst, destAddr, len);
      

      I believe the real intention here is to copy chunks of size bytes, the current code is already copying everything on the first iteration, then performing additional chunked copies.

      Attachments

        1. HBASE-22496.master.001.patch
          1 kB
          Wellington Chevreuil

        Activity

          People

            wchevreuil Wellington Chevreuil
            wchevreuil Wellington Chevreuil
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: