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

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


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

commit fb35da9a2ee898122c0814ddfa8de742ead9567b
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);
                 }

Reply via email to