You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by la...@apache.org on 2019/12/12 17:10:23 UTC

[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5610 Dropping a view or column with a 4.14 client raises an ArrayIndexOutOfBoundsException on 4.15 server.

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

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


The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
     new 7cc5f06  PHOENIX-5610 Dropping a view or column with a 4.14 client raises an ArrayIndexOutOfBoundsException on 4.15 server.
7cc5f06 is described below

commit 7cc5f062df25e819fcba8d30942926be42cc50e2
Author: Lars Hofhansl <la...@apache.org>
AuthorDate: Thu Dec 12 09:10:19 2019 -0800

    PHOENIX-5610 Dropping a view or column with a 4.14 client raises an ArrayIndexOutOfBoundsException on 4.15 server.
---
 .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index dab77b6..12e2f12 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -2473,6 +2473,14 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
             }
         }
 
+        if (clientVersion < MIN_SPLITTABLE_SYSTEM_CATALOG && tableType == PTableType.VIEW) {
+            try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(env.getConfiguration()).unwrap(PhoenixConnection.class)) {
+                PTable pTable = PhoenixRuntime.getTableNoCache(connection, table.getParentName().getString());
+                table = ViewUtil.addDerivedColumnsAndIndexesFromParent(connection, table, pTable);
+            } catch (ClassNotFoundException e) {
+                throw new IOException(e);
+            }
+        }
         return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS,
                 EnvironmentEdgeManager.currentTimeMillis(), table, tableNamesToDelete, sharedTablesToDelete);
     }
@@ -2713,6 +2721,14 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
                     return result;
                 } else {
                     table = buildTable(key, cacheKey, region, HConstants.LATEST_TIMESTAMP, clientVersion);
+                    if (clientVersion < MIN_SPLITTABLE_SYSTEM_CATALOG && type == PTableType.VIEW) {
+                        try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(env.getConfiguration()).unwrap(PhoenixConnection.class)) {
+                            PTable pTable = PhoenixRuntime.getTableNoCache(connection, table.getParentName().getString());
+                            table = ViewUtil.addDerivedColumnsAndIndexesFromParent(connection, table, pTable);
+                        } catch (ClassNotFoundException e) {
+                            throw new IOException(e);
+                        }
+                    }
                     return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, currentTime, table,
                             tableNamesToDelete, sharedTablesToDelete);
                 }