commit e3425aa4593e37841c2b3fa94887c331b4ab9d11 Author: Yu Li Date: Tue Jan 12 15:25:44 2016 +0800 HBASE-15089 Compatibility issue on HTable#flushCommits diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutator.java index 3287335..c00fd41 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutator.java @@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.classification.InterfaceStability; import java.io.Closeable; import java.io.IOException; +import java.io.InterruptedIOException; import java.util.List; /** @@ -81,9 +82,10 @@ public interface BufferedMutator extends Closeable { * wire as part of a batch. Currently only supports {@link Put} and {@link Delete} mutations. * * @param mutation The data to send. - * @throws IOException if a remote or network exception occurs. + * @throws InterruptedIOException if a remote or network exception occurs. + * @throws RetriesExhaustedWithDetailsException if retry more than max setting */ - void mutate(Mutation mutation) throws IOException; + void mutate(Mutation mutation) throws InterruptedIOException, RetriesExhaustedWithDetailsException; /** * Send some {@link Mutation}s to the table. The mutations will be buffered and sent over the @@ -91,9 +93,11 @@ public interface BufferedMutator extends Closeable { * in a single batch; it will be broken up according to the write buffer capacity. * * @param mutations The data to send. - * @throws IOException if a remote or network exception occurs. + * @throws InterruptedIOException if a remote or network exception occurs. + * @throws RetriesExhaustedWithDetailsException if retry more than max setting */ - void mutate(List mutations) throws IOException; + void mutate(List mutations) throws InterruptedIOException, + RetriesExhaustedWithDetailsException; /** * Performs a {@link #flush()} and releases any resources held. @@ -106,10 +110,10 @@ public interface BufferedMutator extends Closeable { /** * Executes all the buffered, asynchronous {@link Mutation} operations and waits until they * are done. - * - * @throws IOException if a remote or network exception occurs. + * @throws InterruptedIOException if a remote or network exception occurs + * @throws RetriesExhaustedWithDetailsException if retry more than max setting */ - void flush() throws IOException; + void flush() throws InterruptedIOException, RetriesExhaustedWithDetailsException; /** * Returns the maximum size in bytes of the write buffer for this HTable. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java index a3f6fe6..04d619a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java @@ -134,7 +134,7 @@ public interface Connection extends Abortable, Closeable { * @param params details on how to instantiate the {@code BufferedMutator}. * @return a {@link BufferedMutator} for the supplied tableName. */ - public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException; + public BufferedMutator getBufferedMutator(BufferedMutatorParams params); /** * Retrieve a RegionLocator implementation to inspect region information on a table. The returned diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java index ce5a44c..f4003dd 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -560,10 +560,10 @@ public class HTable implements HTableInterface { /** * {@inheritDoc} - * @throws IOException */ @Override - public void put(final Put put) throws IOException { + public void put(final Put put) throws InterruptedIOException, + RetriesExhaustedWithDetailsException { getBufferedMutator().mutate(put); if (autoFlush) { flushCommits(); @@ -572,10 +572,10 @@ public class HTable implements HTableInterface { /** * {@inheritDoc} - * @throws IOException */ @Override - public void put(final List puts) throws IOException { + public void put(final List puts) throws InterruptedIOException, + RetriesExhaustedWithDetailsException { getBufferedMutator().mutate(puts); if (autoFlush) { flushCommits(); @@ -938,10 +938,9 @@ public class HTable implements HTableInterface { /** * {@inheritDoc} - * @throws IOException */ @Override - public void flushCommits() throws IOException { + public void flushCommits() throws InterruptedIOException, RetriesExhaustedWithDetailsException { if (mutator == null) { // nothing to flush if there's no mutator; don't bother creating one. return; @@ -1306,7 +1305,7 @@ public class HTable implements HTableInterface { } @VisibleForTesting - BufferedMutator getBufferedMutator() throws IOException { + BufferedMutator getBufferedMutator() { if (mutator == null) { this.mutator = (BufferedMutatorImpl) connection.getBufferedMutator( new BufferedMutatorParams(tableName)