Github user twdsilva commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/303#discussion_r201800952
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---
@@ -1893,26 +1981,45 @@ public static void upgradeTable(PhoenixConnection
conn, String srcTable) throws
conn.commit();
}
conn.getQueryServices().clearTableFromCache(
- conn.getTenantId() == null ?
ByteUtil.EMPTY_BYTE_ARRAY : conn.getTenantId().getBytes(),
+ tenantIdBytes,
index.getSchemaName().getBytes(),
index.getTableName().getBytes(),
PhoenixRuntime.getCurrentScn(readOnlyProps));
}
updateIndexesSequenceIfPresent(conn, table);
conn.commit();
-
} else {
throw new RuntimeException("Error: problem occured during
upgrade. Table is not upgraded successfully");
}
if (table.getType() == PTableType.VIEW) {
logger.info(String.format("Updating link information for
view '%s' ..", table.getTableName()));
updateLink(conn, oldPhysicalName,
newPhysicalTablename,table.getSchemaName(),table.getTableName());
conn.commit();
-
+
+ // if the view is a first level child, then we need to
create the PARENT_TABLE link
+ // that was overwritten by the PHYSICAL_TABLE link
--- End diff --
Yes this will make it so that the parent link row will be created correctly
when upgrading tables to be namespace mapped.
---