HBase
  1. HBase
  2. HBASE-1968

Give clients access to the write buffer

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.20.2
    • Component/s: None
    • Labels:
      None

      Description

      From a Trend dev team:

      When insert rows into one table by calling the method public synchronized void put(final Put put), if the column family of one row does not exist, the insert operation will failed and throw NoSuchColumnFamilyException.. We observed that all the following insert operation will fails even though all of them have valid column family. That is one exception of insert operation can cause failure of all the following insert operation.

      Their further analysis explains in detail the scenario, which I will summarize here:

      1) An invalid put is added to the writeBuffer by put(Put put). It will trigger a NoSuchColumnFamilyException once it goes to the region server.

      2) At some point, the buffer is flushed.

      3) When the invalid put is processed, an exception is thrown. The finally clause of flushCommits() removes all successful puts from the writebuffer list but the failed put remains at the top. This entry becomes an immovable blocker which prevents any subsequent entry from being processed.

      4) Subsequent puts will add more entries to the write buffer until the buffer limit is reached, compounding the problem by allowing more edits to be queued which can never be processed.

      A workaround could be for the client to call getWriteBuffer() – on trunk – and remove the entry at the head of the list manually, but without the patch on this issue, the client cannot get access to the list on branch.

        Activity

        Hide
        Andrew Purtell added a comment -
        Index: src/java/org/apache/hadoop/hbase/client/HTable.java
        ===================================================================
        --- src/java/org/apache/hadoop/hbase/client/HTable.java	(revision 834067)
        +++ src/java/org/apache/hadoop/hbase/client/HTable.java	(working copy)
        @@ -709,6 +709,14 @@
             }
           }
         
        +  /**
        +   * Get the write buffer
        +   * @return the current write buffer
        +   */
        +  public ArrayList<Put> getWriteBuffer() {
        +    return writeBuffer;
        +  }
        +
           // Old API. Pre-hbase-880, hbase-1304.
           
           /**
        
        Show
        Andrew Purtell added a comment - Index: src/java/org/apache/hadoop/hbase/client/HTable.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HTable.java (revision 834067) +++ src/java/org/apache/hadoop/hbase/client/HTable.java (working copy) @@ -709,6 +709,14 @@ } } + /** + * Get the write buffer + * @ return the current write buffer + */ + public ArrayList<Put> getWriteBuffer() { + return writeBuffer; + } + // Old API. Pre-hbase-880, hbase-1304. /**
        Hide
        Andrew Purtell added a comment -

        Committed trivial patch to 0.20 branch.

        Show
        Andrew Purtell added a comment - Committed trivial patch to 0.20 branch.
        Hide
        Jean-Daniel Cryans added a comment -

        Any reason not to apply it on trunk?

        Show
        Jean-Daniel Cryans added a comment - Any reason not to apply it on trunk?
        Hide
        Andrew Purtell added a comment -

        getWriteBuffer is already available on trunk.

        Show
        Andrew Purtell added a comment - getWriteBuffer is already available on trunk.
        Hide
        Jean-Daniel Cryans added a comment -

        Sorry brain lag

        Show
        Jean-Daniel Cryans added a comment - Sorry brain lag

          People

          • Assignee:
            Andrew Purtell
            Reporter:
            Andrew Purtell
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development