PHOENIX-5610 Dropping a view or column with a 4.14 client raises an ArrayIndexOutOfBoundsException on 4.15 server.
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 86afe8d..fb626c4 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
@@ -2490,6 +2490,14 @@
}
}
+ 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);
}
@@ -2731,6 +2739,14 @@
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);
}