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

Correct the javadoc/behaviour of the APIs in ByteBufferUtils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • None
    • None
    • Reviewed

    Description

      There are some issues either with the javadoc or the actual behaviour of some APIs in BBUtils.
      For eg,
      BBUtil#copyFromBufferToBuffer() says

        /**
         * Copy one buffer's whole data to another. Write starts at the current position of 'out' buffer.
         * Note : This will advance the position marker of {@code out} but not change the position maker
         * for {@code in}. The position and limit of the {@code in} buffer to be set properly by caller.
         * @param in source buffer
         * @param out destination buffer
      

      But this is true in case of UNSAFE.

          if (UNSAFE_AVAIL) {
            int length = in.remaining();
            UnsafeAccess.copy(in, in.position(), out, out.position(), length);
            out.position(out.position() + length);
          } else {
            out.put(in);
          }
      

      But in other case where we move the else - the 'in' is also advanced. So we need to either correct the behaviour or change the doc and see all the used places. This JIRA can be used to correct all the APIs in this util class.

      Attachments

        1. HBASE-16880.patch
          3 kB
          ramkrishna.s.vasudevan

        Activity

          People

            ram_krish ramkrishna.s.vasudevan
            ram_krish ramkrishna.s.vasudevan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: