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

Remove byte[] from formal parameter of sizeOf() of ClassSize, ClassSize.MemoryLayout and ClassSize.UnsafeLayout

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0-alpha-2, 2.0.0
    • util
    • None
    • Reviewed

    Description

      In ClassSize class and its internal static class, sizeOf() function has 2 formal parameters: byte[] b and int len. But the function's internal logic does not use or refer to byte[] b. Could be removed.

      hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java
      // Class of ClassSize
      public static long sizeOf(byte[] b, int len) {
        return memoryLayout.sizeOf(b, len);
      }
      
      // Class of ClassSize.MemoryLayout
      long sizeOf(byte[] b, int len) {
        return align(arrayHeaderSize() + len);
      }
      
      // Class of ClassSize.UnsafeLayout
      long sizeOf(byte[] b, int len) {
        return align(arrayHeaderSize() + len * UnsafeAccess.theUnsafe.ARRAY_BYTE_INDEX_SCALE);
      }
      

      Attachments

        1. HBASE-18389.master.000.patch
          5 kB
          Xiang Li
        2. HBASE-18389.master.001.patch
          5 kB
          Xiang Li
        3. HBASE-18389.master.002.patch
          5 kB
          Xiang Li
        4. HBASE-18389.master.003.patch
          5 kB
          Xiang Li

        Activity

          People

            xiangli Xiang Li
            xiangli Xiang Li
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: