You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2022/08/02 00:23:19 UTC

[GitHub] [phoenix] apurtell commented on a diff in pull request #1477: PHOENIX-6758 During HBase 2 upgrade Phoenix Self healing task fails to create server side connection before reading SYSTEM.TASK

apurtell commented on code in PR #1477:
URL: https://github.com/apache/phoenix/pull/1477#discussion_r935011110


##########
phoenix-core/src/main/java/org/apache/phoenix/query/AdminUtilWithFallback.java:
##########
@@ -0,0 +1,105 @@
+package org.apache.phoenix.query;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
+import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos;
+import org.apache.hadoop.hbase.zookeeper.ZKUtil;
+import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
+import org.apache.hadoop.hbase.zookeeper.ZNodePaths;
+import org.apache.zookeeper.KeeperException;
+
+/**
+ * Admin utility class specifically useful for running Admin APIs in the middle of the

Review Comment:
   Good comment



##########
phoenix-core/src/main/java/org/apache/phoenix/query/AdminUtilWithFallback.java:
##########
@@ -0,0 +1,105 @@
+package org.apache.phoenix.query;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
+import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos;
+import org.apache.hadoop.hbase.zookeeper.ZKUtil;
+import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
+import org.apache.hadoop.hbase.zookeeper.ZNodePaths;
+import org.apache.zookeeper.KeeperException;
+
+/**
+ * Admin utility class specifically useful for running Admin APIs in the middle of the
+ * rolling upgrade from HBase 1.x to 2.x versions. Some of the Admin APIs fail to retrieve
+ * table state details from meta table if master is running on 1.x version and coprocs are
+ * running on 2.x version. Hence, as a fallback, server side coproc can directly perform
+ * zookeeper look-up to retrieve table state data. The fallback usecases would not be
+ * encountered for fully upgraded 2.x cluster.
+ */
+public class AdminUtilWithFallback {
+
+  private static final Logger LOG = LoggerFactory.getLogger(AdminUtilWithFallback.class);
+
+  public static boolean tableExists(Admin admin, TableName tableName)
+      throws IOException, InterruptedException {
+    try {
+      return admin.tableExists(tableName);
+    } catch (IOException e) {
+      if (e instanceof NoSuchColumnFamilyException || (e.getCause() != null
+          && e.getCause() instanceof NoSuchColumnFamilyException)) {
+        LOG.error("Admin API to retrieve table existence failed due to missing CF in meta."

Review Comment:
   Should only be WARN level because we have a fallback



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

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