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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.96.2, 0.98.1, 0.99.0
    • None
    • None
    • 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. 10656.096v2.txt
          17 kB
          Michael Stack
        2. 10656-098.v2.txt
          17 kB
          Michael Stack
        3. 10656-trunk.v2.patch
          18 kB
          Michael Stack
        4. HBASE-10656-0.96.patch
          17 kB
          Hiroshi Ikeda
        5. HBASE-10656-addition.patch
          3 kB
          Hiroshi Ikeda
        6. HBASE-10656-trunk.patch
          18 kB
          Hiroshi Ikeda
        7. MyCounter.java
          4 kB
          Hiroshi Ikeda
        8. MyCounter2.java
          3 kB
          Hiroshi Ikeda
        9. MyCounter3.java
          4 kB
          Hiroshi Ikeda
        10. MyCounterTest.java
          2 kB
          Hiroshi Ikeda
        11. MyCounterTest.java
          2 kB
          Hiroshi Ikeda
        12. output.pdf
          67 kB
          Hiroshi Ikeda
        13. output.txt
          2 kB
          Hiroshi Ikeda
        14. output2.pdf
          151 kB
          Hiroshi Ikeda
        15. output2.txt
          3 kB
          Hiroshi Ikeda
        16. PerformanceTestApp.java
          4 kB
          Hiroshi Ikeda
        17. PerformanceTestApp2.java
          6 kB
          Hiroshi Ikeda

        Activity

          People

            ikeda Hiroshi Ikeda
            ikeda Hiroshi Ikeda
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: