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

high-scale-lib's Counter depends on Oracle (Sun) JRE, and also has some bug

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.96.2, 0.98.1, 0.99.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Cliff's high-scale-lib's Counter is used in important classes (for example, HRegion) in HBase, but Counter uses sun.misc.Unsafe, that is implementation detail of the Java standard library and belongs to Oracle (Sun). That consequently makes HBase depend on the specific JRE Implementation.

      To make matters worse, Counter has a bug and you may get wrong result if you mix a reading method into your logic calling writing methods.

      In more detail, I think the bug is caused by reading an internal array field without resolving memory caching, which is intentional the comment says, but storing the read result into a volatile field. That field may be not changed after you can see the true values of the array field, and also may be not changed after updating the "next" CAT instance's values in some race condition when extending CAT instance chain.

      Anyway, it is possible that you create a new alternative class which only depends on the standard library. I know Java8 provides its alternative, but HBase should support Java6 and Java7 for some time.

        Attachments

        1. PerformanceTestApp2.java
          6 kB
          Hiroshi Ikeda
        2. PerformanceTestApp.java
          4 kB
          Hiroshi Ikeda
        3. output2.txt
          3 kB
          Hiroshi Ikeda
        4. output2.pdf
          151 kB
          Hiroshi Ikeda
        5. output.txt
          2 kB
          Hiroshi Ikeda
        6. output.pdf
          67 kB
          Hiroshi Ikeda
        7. MyCounterTest.java
          2 kB
          Hiroshi Ikeda
        8. MyCounterTest.java
          2 kB
          Hiroshi Ikeda
        9. MyCounter3.java
          4 kB
          Hiroshi Ikeda
        10. MyCounter2.java
          3 kB
          Hiroshi Ikeda
        11. MyCounter.java
          4 kB
          Hiroshi Ikeda
        12. HBASE-10656-trunk.patch
          18 kB
          Hiroshi Ikeda
        13. HBASE-10656-addition.patch
          3 kB
          Hiroshi Ikeda
        14. HBASE-10656-0.96.patch
          17 kB
          Hiroshi Ikeda
        15. 10656-trunk.v2.patch
          18 kB
          stack
        16. 10656-098.v2.txt
          17 kB
          stack
        17. 10656.096v2.txt
          17 kB
          stack

          Activity

            People

            • Assignee:
              ikeda Hiroshi Ikeda
              Reporter:
              ikeda Hiroshi Ikeda
            • Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: