phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JamesRTaylor <...@git.apache.org>
Subject [GitHub] phoenix pull request #303: PHOENIX-3534 Support multi region SYSTEM.CATALOG ...
Date Wed, 30 May 2018 22:18:20 GMT
Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/303#discussion_r191940463
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
---
    @@ -1995,36 +2287,46 @@ public void dropTable(RpcController controller, DropTableRequest
request,
     
             try {
                 List<Mutation> tableMetadata = ProtobufUtil.getMutations(request);
    +            List<Mutation> childLinkMutations = Lists.newArrayList();
                 MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, rowKeyMetaData);
                 byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
                 schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
                 tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
    +            PTableType pTableType=PTableType.fromSerializedValue(tableType);
                 // Disallow deletion of a system table
    -            if (tableType.equals(PTableType.SYSTEM.getSerializedValue())) {
    +            if (pTableType == PTableType.SYSTEM) {
                     builder.setReturnCode(MetaDataProtos.MutationCode.UNALLOWED_TABLE_MUTATION);
                     builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
                     done.run(builder.build());
                     return;
                 }
    +            
                 List<byte[]> tableNamesToDelete = Lists.newArrayList();
                 List<SharedTableState> sharedTablesToDelete = Lists.newArrayList();
    -            // No need to lock parent table for views
    -            byte[] parentTableName = MetaDataUtil.getParentTableName(tableMetadata);
    -            byte[] lockTableName = parentTableName == null || tableType.equals(PTableType.VIEW.getSerializedValue())
? tableName : parentTableName;
    -            byte[] lockKey = SchemaUtil.getTableKey(tenantIdBytes, schemaName, lockTableName);
    -            byte[] key =
    -                    parentTableName == null ? lockKey : SchemaUtil.getTableKey(tenantIdBytes,
    -                        schemaName, tableName);
    +            
    +            byte[] lockKey = SchemaUtil.getTableKey(tenantIdBytes, schemaName, tableName);
                 Region region = env.getRegion();
    -            MetaDataMutationResult result = checkTableKeyInRegion(key, region);
    +            MetaDataMutationResult result = checkTableKeyInRegion(lockKey, region);
                 if (result != null) {
                     done.run(MetaDataMutationResult.toProto(result));
                     return;
                 }
    -            PTableType ptableType=PTableType.fromSerializedValue(tableType);
    +            
    +            byte[] parentTableName = MetaDataUtil.getParentTableName(tableMetadata);
    +            byte[] parentLockKey = null;
    +            // No need to lock parent table for views
    +            if (parentTableName != null && pTableType != PTableType.VIEW) {
    +                parentLockKey = SchemaUtil.getTableKey(tenantIdBytes, schemaName, parentTableName);
    --- End diff --
    
    Shouldn't need this parentLockKey any longer, yes? Or is this only for indexes?


---

Mime
View raw message