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

HTable.incrementColumnValue does not take negative 'amount'

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.19.1
    • 0.19.2, 0.20.0
    • Client
    • None
    • Ubuntu 8.10

    Description

      Apparently HRegion.binaryIncrement() assumes argument 'amount' is always positive. It would be nice to support decrement operation. In my application, a counter can go both up and down.

      Quick fix is

      public byte [] binaryIncrement(byte [] value, long amount)

      { return Bytes.toBytes(Bytes.toLong(value) + amount); }

      but it is 2x~3x slower than current implementation for small positive 'amount' value. I have not yet found a good implementation to support negative 'amount' argument, AND match the speed of current implementation. Anyway, I just want to throw this out there and see if anybody is interested in negative 'amount' support.

      Attachments

        1. HBASE-1347_v2.patch
          8 kB
          Evgeny Ryabitskiy
        2. HBASE-1347_v3.patch
          9 kB
          Evgeny Ryabitskiy
        3. HBASE-1347.patch
          8 kB
          Evgeny Ryabitskiy
        4. HBASE-1347-quick-fix.patch
          1 kB
          atppp

        Activity

          People

            apparition Evgeny Ryabitskiy
            atppp atppp
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: