[ https://issues.apache.org/jira/browse/PHOENIX-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15368538#comment-15368538 ]
James Taylor edited comment on PHOENIX-3002 at 7/8/16 9:52 PM: --------------------------------------------------------------- Actually, there's one issue in that the salt column is not included as a column in the metadata, so you shouldn't add one here for salting (would be great to verify with a test for this): {code} @@ -373,6 +373,8 @@ public class UpgradeUtil { String indexTableName = rs.getString(2); String dataTableName = rs.getString(3); String tenantId = rs.getString(4); + boolean multiTenantTable = rs.getBoolean(5); + boolean isSaltedTable = rs.getInt(6) != 0; String getColumns = "SELECT COLUMN_NAME, COLUMN_FAMILY FROM SYSTEM.CATALOG WHERE TABLE_SCHEM " + (schemaName == null ? "IS NULL " : "='" + schemaName+ "'") @@ -383,12 +385,15 @@ public class UpgradeUtil { List<String> indexedColumns = new ArrayList<String>(1); List<String> coveredColumns = new ArrayList<String>(1); + int numColumnsToSkip = 1 + (multiTenantTable ? 1 : 0) + (isSaltedTable ? 1 : 0); {code} Better IMHO to add an {{AND KEY_SEQ > ?}} to the WHERE clause based on if multi tenant table instead of mucking with the loop. Also, minor nit, but instead of matching {{INDEX_TYPE=2}} it's better to use {{INDEX_TYPE=}} + IndexType.PHYSICAL_TABLE.getSerializedValue() was (Author: jamestaylor): Actually, there's one issue in that the salt column is not included as a column in the metadata, so you shouldn't add one here for salting (would be great to verify with a test for this): {code} @@ -373,6 +373,8 @@ public class UpgradeUtil { String indexTableName = rs.getString(2); String dataTableName = rs.getString(3); String tenantId = rs.getString(4); + boolean multiTenantTable = rs.getBoolean(5); + boolean isSaltedTable = rs.getInt(6) != 0; String getColumns = "SELECT COLUMN_NAME, COLUMN_FAMILY FROM SYSTEM.CATALOG WHERE TABLE_SCHEM " + (schemaName == null ? "IS NULL " : "='" + schemaName+ "'") @@ -383,12 +385,15 @@ public class UpgradeUtil { List<String> indexedColumns = new ArrayList<String>(1); List<String> coveredColumns = new ArrayList<String>(1); + int numColumnsToSkip = 1 + (multiTenantTable ? 1 : 0) + (isSaltedTable ? 1 : 0); {code} Better IMHO to add an {{AND KEY_SEQ > ?}} to the WHERE clause based on if multi tenant table instead of mucking with the loop. - Also, minor nit, but instead of matching {{INDEX_TYPE=2}} it's better to use {{INDEX_TYPE=}} + IndexType.PHYSICAL_TABLE.getSerializedValue() > Upgrading to 4.8 doesn't recreate local indexes > ----------------------------------------------- > > Key: PHOENIX-3002 > URL: https://issues.apache.org/jira/browse/PHOENIX-3002 > Project: Phoenix > Issue Type: Bug > Reporter: Samarth Jain > Assignee: Rajeshbabu Chintaguntla > Priority: Blocker > Fix For: 4.8.0 > > Attachments: PHOENIX-3002.patch, PHOENIX-3002_addendum.patch, > PHOENIX-3002_addendum2.patch, PHOENIX-3002_v0.patch, PHOENIX-3002_v1.patch, > PHOENIX-3002_v2.patch, PHOENIX-3002_v3.patch > > > [~rajeshbabu] - I noticed that when upgrading to 4.8, local indexes created > with 4.7 or before aren't getting recreated with the new local indexes > implementation. I am not seeing the metadata rows for the recreated indices > in SYSTEM.CATALOG. -- This message was sent by Atlassian JIRA (v6.3.4#6332)