Source:
<code>public static void syncTableAndIndexProperties(PhoenixConnection conn, Admin admin) throws SQLException, IOException { Set<TableDescriptor> tableDescriptorsToSynchronize = new HashSet<>(); for (TableDescriptor origTableDesc : admin.listTableDescriptors()) { if (MetaDataUtil.isViewIndex(origTableDesc.getTableName().getNameWithNamespaceInclAsString())) { continue; } PTable table; String tableName = origTableDesc.getTableName().getNameAsString(); try { table = PhoenixRuntime.getTable(conn, tableName); } catch (TableNotFoundException e) { logger.warn("Error getting PTable for HBase table: " + tableName); continue; } if (table.getType() == PTableType.INDEX) { if (table.getIndexType() == IndexType.GLOBAL && !table.isTransactional() && <START> !table.isImmutableRows() && <END> !origTableDesc.hasCoprocessor(GlobalIndexChecker.class.getName())) { TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(origTableDesc); builder.addCoprocessor(GlobalIndexChecker.class.getName(), null, QueryServicesOptions.DEFAULT_COPROCESSOR_PRIORITY - 1, null); tableDescriptorsToSynchronize.add(builder.build()); } continue; } syncUpdateCacheFreqAllIndexes(conn, table); ColumnFamilyDescriptor defaultColFam = origTableDesc.getColumnFamily(SchemaUtil.getEmptyColumnFamily(table)); Map<String, Object> syncedProps = MetaDataUtil.getSyncedProps(defaultColFam); addTableDescIfPropsChanged(origTableDesc, defaultColFam, syncedProps, tableDescriptorsToSynchronize); syncGlobalIndexesForTable(conn.getQueryServices(), table, defaultColFam, syncedProps, tableDescriptorsToSynchronize); syncViewIndexTable(conn.getQueryServices(), table, defaultColFam, syncedProps, tableDescriptorsToSynchronize); } for (TableDescriptor t: tableDescriptorsToSynchronize) { admin.modifyTable(t); } }</code><technical_language>isTransactional() isImmutableRows() checks done originalTableDesc index table</technical_language>

Target:
public static void syncTableAndIndexProperties(PhoenixConnection conn, Admin admin) throws SQLException, IOException { Set<TableDescriptor> tableDescriptorsToSynchronize = new HashSet<>(); for (TableDescriptor origTableDesc : admin.listTableDescriptors()) { if (MetaDataUtil.isViewIndex(origTableDesc.getTableName().getNameWithNamespaceInclAsString())) { continue; } PTable table; String tableName = origTableDesc.getTableName().getNameAsString(); try { table = PhoenixRuntime.getTable(conn, tableName); } catch (TableNotFoundException e) { logger.warn("Error getting PTable for HBase table: " + tableName); continue; } if (table.getType() == PTableType.INDEX) { continue; } syncUpdateCacheFreqAllIndexes(conn, table); ColumnFamilyDescriptor defaultColFam = origTableDesc.getColumnFamily(SchemaUtil.getEmptyColumnFamily(table)); Map<String, Object> syncedProps = MetaDataUtil.getSyncedProps(defaultColFam); addTableDescIfPropsChanged(origTableDesc, defaultColFam, syncedProps, tableDescriptorsToSynchronize); syncGlobalIndexesForTable(conn.getQueryServices(), table, defaultColFam, syncedProps, tableDescriptorsToSynchronize); syncViewIndexTable(conn.getQueryServices(), table, defaultColFam, syncedProps, tableDescriptorsToSynchronize); } for (TableDescriptor t: tableDescriptorsToSynchronize) { admin.modifyTable(t); } }