[
https://issues.apache.org/jira/browse/PHOENIX-935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13981885#comment-13981885
]
James Taylor commented on PHOENIX-935:
--------------------------------------
Pushed to local-index branch - thanks for the contributions, [~rajesh23].
Couple minor additions needed. In
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java, you
should add a TableRef to the local index table if we're not dropping the table
so that the rows are deleted from it:
+ if (tableType == PTableType.TABLE &&
(table.isMultiTenant() || MetaDataUtil.hasViewIndexTable(connection,
table.getPhysicalName()) || MetaDataUtil.hasLocalIndexTable(connection,
table.getPhysicalName()))) {
MetaDataUtil.deleteViewIndexSequences(connection,
table.getPhysicalName());
// TODO: consider removing this, as the DROP INDEX
done for each DROP VIEW command
// would have deleted all the rows already
if (!dropMetaData) {
String viewIndexSchemaName =
MetaDataUtil.getViewIndexSchemaName(schemaName);
String viewIndexTableName =
MetaDataUtil.getViewIndexTableName(tableName);
PTable viewIndexTable = new PTableImpl(null,
viewIndexSchemaName, viewIndexTableName, ts, table.getColumnFamilies());
tableRefs.add(new TableRef(null,
viewIndexTable, ts, false));
// TODO Rajeshbabu: add code here similar to
the above, but for the local index table name.
// This will cause the local index rows to be
deleted if the underlying Phoenix table is dropped,
// but we're keeping the meta data around
(based on the dropMetaData flag)
}
In ConnectionQueryServicesImpl.java, you should disable and drop the local
index table any time we're doing the same to the view index table. For example
here:
case TABLE_ALREADY_EXISTS:
ReadOnlyProps props = this.getProps();
boolean dropMetadata = props.getBoolean(DROP_METADATA_ATTRIB,
DEFAULT_DROP_METADATA);
if (dropMetadata) {
dropTables(result.getTableNamesToDelete());
}
if (tableType == PTableType.TABLE) {
byte[] physicalTableName =
SchemaUtil.getTableNameAsBytes(schemaBytes, tableBytes);
long timestamp = MetaDataUtil.getClientTimeStamp(tableMetaData);
ensureViewIndexTableDropped(physicalTableName, timestamp);
// TODO Rajeshbabu: ensureLocalIndexTableDropped
}
break;
> create local index table with the same split keys of user table
> ---------------------------------------------------------------
>
> Key: PHOENIX-935
> URL: https://issues.apache.org/jira/browse/PHOENIX-935
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: rajeshbabu
> Assignee: rajeshbabu
> Attachments: PHOENIX-935.patch, PHOENIX-935_v2.patch
>
>
> For co-locating user table regions and index table regions, the regions key
> ranges should be same. So when user specify to create local index, internally
> we can create the index table with the same split keys of user table.
--
This message was sent by Atlassian JIRA
(v6.2#6252)