Github user twdsilva commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/313#discussion_r205950165
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---
@@ -3604,6 +3675,17 @@ public MutationState addColumn(PTable table,
List<ColumnDef> origColumnDefs,
}
} finally {
connection.setAutoCommit(wasAutoCommit);
+ if (!columns.isEmpty()) {
+ for (PColumn pColumn : columns) {
+ PName physicalName = table.getPhysicalName();
+ String physicalSchemaName =
+
SchemaUtil.getSchemaNameFromFullName(physicalName.getString());
+ String physicalTableName =
+
SchemaUtil.getTableNameFromFullName(physicalName.getString());
+ deleteCell(null, physicalSchemaName, physicalTableName,
--- End diff --
I changed the code to only delete the cells if we were able to successfully
do the checkAndPut.
When we add a column we write a cell per column that we are creating.
When we drop a base table or create a view, we write a single cell with the
rowkey of the physical table (to prevent a view being created while we are
dropping the base table).
---