You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by op...@apache.org on 2018/02/12 07:08:26 UTC
hbase git commit: HBASE-19972 Should rethrow the
RetriesExhaustedWithDetailsException when failed to apply the batch in
ReplicationSink
Repository: hbase
Updated Branches:
refs/heads/master 0593dda66 -> 629eaf8b7
HBASE-19972 Should rethrow the RetriesExhaustedWithDetailsException when failed to apply the batch in ReplicationSink
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/629eaf8b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/629eaf8b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/629eaf8b
Branch: refs/heads/master
Commit: 629eaf8b74a443fb9f6c5c99b5b3174bc91514ba
Parents: 0593dda
Author: huzheng <op...@gmail.com>
Authored: Sun Feb 11 14:48:21 2018 +0800
Committer: huzheng <op...@gmail.com>
Committed: Sun Feb 11 14:48:21 2018 +0800
----------------------------------------------------------------------
.../regionserver/ReplicationSink.java | 3 +-
.../regionserver/TestReplicationSink.java | 38 ++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/629eaf8b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
index 902971e..5a05660 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
@@ -404,9 +404,10 @@ public class ReplicationSink {
} catch (RetriesExhaustedWithDetailsException rewde) {
for (Throwable ex : rewde.getCauses()) {
if (ex instanceof TableNotFoundException) {
- throw new TableNotFoundException("'"+tableName+"'");
+ throw new TableNotFoundException("'" + tableName + "'");
}
}
+ throw rewde;
} catch (InterruptedException ix) {
throw (InterruptedIOException) new InterruptedIOException().initCause(ix);
} finally {
http://git-wip-us.apache.org/repos/asf/hbase/blob/629eaf8b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
index 4629c68..fcce84f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
@@ -44,12 +44,15 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.testclassification.MediumTests;
@@ -58,6 +61,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.util.HFileTestUtil;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
@@ -271,6 +275,40 @@ public class TestReplicationSink {
assertEquals(0, res.size());
}
+ @Test
+ public void testRethrowRetriesExhaustedWithDetailsException() throws Exception {
+ TableName notExistTable = TableName.valueOf("notExistTable");
+ List<WALEntry> entries = new ArrayList<>();
+ List<Cell> cells = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ entries.add(createEntry(notExistTable, i, KeyValue.Type.Put, cells));
+ }
+ try {
+ SINK.replicateEntries(entries, CellUtil.createCellScanner(cells.iterator()),
+ replicationClusterId, baseNamespaceDir, hfileArchiveDir);
+ Assert.fail("Should re-throw TableNotFoundException.");
+ } catch (TableNotFoundException e) {
+ }
+ entries.clear();
+ cells.clear();
+ for (int i = 0; i < 10; i++) {
+ entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
+ }
+ try (Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration())) {
+ try (Admin admin = conn.getAdmin()) {
+ admin.disableTable(TABLE_NAME1);
+ try {
+ SINK.replicateEntries(entries, CellUtil.createCellScanner(cells.iterator()),
+ replicationClusterId, baseNamespaceDir, hfileArchiveDir);
+ Assert.fail("Should re-throw RetriesExhaustedWithDetailsException.");
+ } catch (RetriesExhaustedWithDetailsException e) {
+ } finally {
+ admin.enableTable(TABLE_NAME1);
+ }
+ }
+ }
+ }
+
/**
* Test replicateEntries with a bulk load entry for 25 HFiles
*/