Github user ankitsinghal commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/329#discussion_r212054923
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
---
@@ -3291,6 +3305,29 @@ public MetaDataMutationResult updateMutation(PTable
table, byte[][] rowKeyMetaDa
}
}
tableMetaData.addAll(additionalTableMetadataMutations);
+ if (type == PTableType.VIEW
+ &&
EncodedColumnsUtil.usesEncodedColumnNames(table) && addingCol
+ && !table.isAppendOnlySchema()) {
+ // When adding a column to a view that
uses encoded column name
+ // scheme, we need to modify the CQ
counters stored in the view's
+ // physical table. So to make sure clients
get the latest PTable, we
+ // need to invalidate the cache entry.
+ // If the table uses APPEND_ONLY_SCHEMA we
use the position of the
+ // column as the encoded column qualifier
and so we don't need to
+ // update the CQ counter in the view
physical table (see
+ // PHOENIX-4737)
+ invalidateList.add(new ImmutableBytesPtr(
+
MetaDataUtil.getPhysicalTableRowForView(table)));
+ byte[] parentSchemaName =
+ table.getParentSchemaName() != null
+ ?
table.getParentSchemaName().getBytes()
+ :
ByteUtil.EMPTY_BYTE_ARRAY;
+ byte[] parentTableName =
table.getParentTableName().getBytes();
+ PTable parentTable =
+ doGetTable(null, parentSchemaName,
parentTableName,
+ clientTimeStamp, null,
request.getClientVersion(), true,
+ true, null);
--- End diff --
You may need to remove doGetTable call as parentTable is not used anywhere
now?
---