You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ya...@apache.org on 2021/01/14 00:07:23 UTC

[phoenix] branch 4.x updated: PHOENIX-6311 Using phoenix-level table exists check in ViewUtil.getSystemTableForChildLinks (#1085)

This is an automated email from the ASF dual-hosted git repository.

yanxinyi pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x by this push:
     new 7645d09  PHOENIX-6311 Using phoenix-level table exists check in ViewUtil.getSystemTableForChildLinks (#1085)
7645d09 is described below

commit 7645d098fc1d9338e86dde8535acf815d913d082
Author: Xinyi Yan <ya...@apache.org>
AuthorDate: Wed Jan 13 16:07:13 2021 -0800

    PHOENIX-6311 Using phoenix-level table exists check in ViewUtil.getSystemTableForChildLinks (#1085)
---
 .../src/main/java/org/apache/phoenix/util/ViewUtil.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ViewUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ViewUtil.java
index 2e11af4..6464fb6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ViewUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ViewUtil.java
@@ -19,6 +19,7 @@ import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SPLITTABLE_SYS
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.PARENT_TENANT_ID_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_TYPE_BYTES;
@@ -40,7 +41,6 @@ import java.util.Set;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -445,16 +445,14 @@ public class ViewUtil {
             Configuration conf) throws SQLException, IOException {
         byte[] fullTableName = SYSTEM_CHILD_LINK_NAME_BYTES;
         if (clientVersion < MIN_SPLITTABLE_SYSTEM_CATALOG) {
-            try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(
-                    conf).unwrap(PhoenixConnection.class);
-                    HBaseAdmin admin = connection.getQueryServices().getAdmin()) {
 
+            try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(conf).
+                    unwrap(PhoenixConnection.class)) {
+                PhoenixRuntime.getTableNoCache(connection, SYSTEM_CHILD_LINK_NAME);
+            } catch (TableNotFoundException e) {
                 // If this is an old client and the CHILD_LINK table doesn't exist i.e. metadata
                 // hasn't been updated since there was never a connection from a 4.15 client
-                if (!admin.tableExists(SchemaUtil.getPhysicalTableName(
-                        SYSTEM_CHILD_LINK_NAME_BYTES, conf))) {
-                    fullTableName = SYSTEM_CATALOG_NAME_BYTES;
-                }
+                fullTableName = SYSTEM_CATALOG_NAME_BYTES;
             } catch (SQLException e) {
                 logger.error("Error getting a connection on the server : " + e);
                 throw e;