virajjasani commented on code in PR #2179:
URL: https://github.com/apache/phoenix/pull/2179#discussion_r2130741044


##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/UpgradeUtil.java:
##########
@@ -1530,15 +1531,23 @@ public static void 
moveHBaseLevelTTLToSYSCAT(PhoenixConnection oldMetaConnection
                             byte[] tableName = 
rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
 
                             String fullTableName = 
SchemaUtil.getTableName(schemaName, tableName);
+                            currentTableName = fullTableName;
                             if 
(SchemaUtil.isSystemTable(SchemaUtil.getTableNameAsBytes(schemaName, 
tableName))) {
                                 //We do not support system table ttl through 
phoenix ttl, and it will be moved to a
                                 //constant value in future commit.
                                 continue;
                             }
+                            PTable pTable = 
oldMetaConnection.getTableFromServerNoCache(schemaName, tableName);

Review Comment:
   As all we want is emptyCF, we don't need to make syscat call if PTable is 
already in cache? So, we can use `oldMetaConnection.getTable(null, 
fullTableName)` instead?



##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/UpgradeUtil.java:
##########
@@ -1530,15 +1531,23 @@ public static void 
moveHBaseLevelTTLToSYSCAT(PhoenixConnection oldMetaConnection
                             byte[] tableName = 
rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
 
                             String fullTableName = 
SchemaUtil.getTableName(schemaName, tableName);
+                            currentTableName = fullTableName;
                             if 
(SchemaUtil.isSystemTable(SchemaUtil.getTableNameAsBytes(schemaName, 
tableName))) {
                                 //We do not support system table ttl through 
phoenix ttl, and it will be moved to a
                                 //constant value in future commit.
                                 continue;
                             }
+                            PTable pTable = 
oldMetaConnection.getTableFromServerNoCache(schemaName, tableName);
+                            byte[] emptyCF = 
SchemaUtil.getEmptyColumnFamily(pTable);
                             TableDescriptor tableDesc = 
admin.getDescriptor(SchemaUtil.getPhysicalTableName(
                                     fullTableName, readOnlyProps));
-                            int ttl = 
tableDesc.getColumnFamily(DEFAULT_COLUMN_FAMILY_BYTES).
-                                    getTimeToLive();
+                            ColumnFamilyDescriptor cfd = 
tableDesc.getColumnFamily(emptyCF);
+                            if (cfd == null) {
+                                LOGGER.warn("Not upgrading HBase level TTL 
definition for table {}", fullTableName);
+                                continue;
+                            }

Review Comment:
   How about?
   
   ```
   if (cfd == null) {
       LOGGER.warn("No emptyCF found. Not upgrading HBase level TTL definition 
for table {}", fullTableName);
       continue;
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to