You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/05/18 15:19:18 UTC

[GitHub] [hbase] wchevreuil commented on a change in pull request #1722: HBASE-24359 Optionally ignore edits for deleted CFs for replication

wchevreuil commented on a change in pull request #1722:
URL: https://github.com/apache/hbase/pull/1722#discussion_r426696887



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java
##########
@@ -279,28 +296,146 @@ private int getEstimatedEntrySize(Entry e) {
     }
   }
 
-  private TableName parseTable(String msg) {
-    // ... TableNotFoundException: '<table>'/n...
-    Pattern p = Pattern.compile("TableNotFoundException: '([\\S]*)'");
-    Matcher m = p.matcher(msg);
-    if (m.find()) {
-      String table = m.group(1);
-      try {
-        // double check that table is a valid table name
-        TableName.valueOf(TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(table)));
-        return TableName.valueOf(table);
-      } catch (IllegalArgumentException ignore) {
+  /**
+   * Check if there's an {@link TableNotFoundException} in the caused by stacktrace.
+   */
+  @VisibleForTesting
+  public static boolean isTableNotFoundException(Throwable io) {
+    if (io instanceof RemoteException) {
+      io = ((RemoteException) io).unwrapRemoteException();
+    }
+    if (io != null && io.getMessage().contains("TableNotFoundException")) {
+      return true;
+    }
+    for (; io != null; io = io.getCause()) {
+      if (io instanceof TableNotFoundException) {
+        return true;

Review comment:
       Do we need these two checks? Sounds like these are redundant.

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java
##########
@@ -279,28 +296,146 @@ private int getEstimatedEntrySize(Entry e) {
     }
   }
 
-  private TableName parseTable(String msg) {
-    // ... TableNotFoundException: '<table>'/n...
-    Pattern p = Pattern.compile("TableNotFoundException: '([\\S]*)'");
-    Matcher m = p.matcher(msg);
-    if (m.find()) {
-      String table = m.group(1);
-      try {
-        // double check that table is a valid table name
-        TableName.valueOf(TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(table)));
-        return TableName.valueOf(table);
-      } catch (IllegalArgumentException ignore) {
+  /**
+   * Check if there's an {@link TableNotFoundException} in the caused by stacktrace.
+   */
+  @VisibleForTesting
+  public static boolean isTableNotFoundException(Throwable io) {
+    if (io instanceof RemoteException) {
+      io = ((RemoteException) io).unwrapRemoteException();
+    }
+    if (io != null && io.getMessage().contains("TableNotFoundException")) {
+      return true;
+    }
+    for (; io != null; io = io.getCause()) {
+      if (io instanceof TableNotFoundException) {
+        return true;
       }
     }
-    return null;
+    return false;
   }
 
-  // Filter a set of batches by TableName
-  private List<List<Entry>> filterBatches(final List<List<Entry>> oldEntryList, TableName table) {
-    return oldEntryList
-        .stream().map(entries -> entries.stream()
-            .filter(e -> !e.getKey().getTableName().equals(table)).collect(Collectors.toList()))
-        .collect(Collectors.toList());
+  /**
+   * Check if there's an {@link NoSuchColumnFamilyException} in the caused by stacktrace.
+   */
+  @VisibleForTesting
+  public static boolean isNoSuchColumnFamilyException(Throwable io) {
+    if (io instanceof RemoteException) {
+      io = ((RemoteException) io).unwrapRemoteException();
+    }
+    if (io != null && io.getMessage().contains("NoSuchColumnFamilyException")) {
+      return true;
+    }
+    for (; io != null; io = io.getCause()) {
+      if (io instanceof NoSuchColumnFamilyException) {
+        return true;

Review comment:
       Same as previous comment.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org