ChinmaySKulkarni commented on a change in pull request #541: PHOENIX-4893 Move
parent column combining logic of view and view inde…
URL: https://github.com/apache/phoenix/pull/541#discussion_r305167348
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
##########
@@ -3975,62 +2889,112 @@ private MetaDataMutationResult dropIndexes(PTable
table, Region region, List<Imm
// index table
Delete delete = new Delete(indexKey, clientTimeStamp);
byte[] linkKey =
- MetaDataUtil.getParentLinkKey(tenantId, schemaName,
tableName, index
- .getTableName().getBytes());
+ MetaDataUtil.getParentLinkKey(tenantId,
table.getSchemaName().getBytes(),
+ table.getTableName().getBytes(),
index.getTableName().getBytes());
// Drop the link between the parent table and the
// index table
Delete linkDelete = new Delete(linkKey, clientTimeStamp);
- List<Mutation> tableMetaData =
Lists.newArrayListWithExpectedSize(2);
Delete tableDelete = delete;
tableMetaData.add(tableDelete);
tableMetaData.add(linkDelete);
+ // Since we're dropping the index, lock it to ensure
+ // that a change in index state doesn't
+ // occur while we're dropping it.
+ acquireLock(region, indexKey, locks);
+ List<Mutation> childLinksMutations = Lists.newArrayList();
+ MetaDataMutationResult result = doDropTable(indexKey,
tenantId, index.getSchemaName().getBytes(),
+ index.getTableName().getBytes(),
table.getName().getBytes(), index.getType(),
+ tableMetaData, childLinksMutations, invalidateList,
tableNamesToDelete, sharedTablesToDelete,
+ false, clientVersion);
+ if (result != null && result.getMutationCode() !=
MutationCode.TABLE_ALREADY_EXISTS) {
+ return result;
+ }
+ // there should be no child links to delete since we are just
dropping an index
+ assert (childLinksMutations.isEmpty());
Review comment:
This can potentially bring down the region server if an `AssertionError`
occurs. Is this check necessary? Can we log an error instead?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services