[ 
https://issues.apache.org/jira/browse/PHOENIX-4764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16644287#comment-16644287
 ] 

ASF GitHub Bot commented on PHOENIX-4764:
-----------------------------------------

Github user BinShi-SecularBird commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/359#discussion_r223905380
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 ---
    @@ -2346,19 +2347,29 @@ public void createTable(RpcController controller, 
CreateTableRequest request,
             }
         }
     
    -    private void dropChildMetadata(byte[] schemaName, byte[] tableName, 
byte[] tenantIdBytes)
    +    public static void dropChildViews(RegionCoprocessorEnvironment env, 
byte[] tenantIdBytes, byte[] schemaName, byte[] tableName)
                 throws IOException, SQLException, ClassNotFoundException {
    -        TableViewFinderResult childViewsResult = new 
TableViewFinderResult();
    -        findAllChildViews(tenantIdBytes, schemaName, tableName, 
childViewsResult);
    +        Table hTable =
    +                ServerUtil.getHTableForCoprocessorScan(env,
    +                        SchemaUtil.getPhysicalTableName(
    +                                
PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME_BYTES,
    +                                env.getConfiguration()));
    +        TableViewFinderResult childViewsResult = 
ViewFinder.findRelatedViews(hTable, tenantIdBytes, schemaName, tableName,
    +                PTable.LinkType.CHILD_TABLE, HConstants.LATEST_TIMESTAMP);
    +
             if (childViewsResult.hasLinks()) {
    +
                 for (TableInfo viewInfo : childViewsResult.getLinks()) {
                     byte[] viewTenantId = viewInfo.getTenantId();
                     byte[] viewSchemaName = viewInfo.getSchemaName();
                     byte[] viewName = viewInfo.getTableName();
    +                logger.debug("dropChildViews :" + 
Bytes.toString(schemaName) + "." + Bytes.toString(tableName) +
    +                        " -> " + Bytes.toString(viewSchemaName) + "." + 
Bytes.toString(viewName) +
    +                        "with tenant id :" + Bytes.toString(viewTenantId));
    --- End diff --
    
    In the code base, even just in this file, I saw it prints debug log only 
when logger.isDebugEnabled() is true. The only exception is that few places 
print debug info for rare case or failure case (actually it should be changed 
to info or error log). You might want to add if (logger.isDebugEnabled()) { ... 
} too for printing debug log.


> Cleanup metadata of child views for a base table that has been dropped
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-4764
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4764
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Thomas D'Silva
>            Assignee: Kadir OZDEMIR
>            Priority: Major
>
> When we drop a base table, we no longer drop all the child view metadata. 
> Clean up the child view metadata during compaction. 
> If we try to recreate a base table that was previously dropped but whose 
> child view metadata wasn't cleaned up throw an exception. Add a test for 
> this. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to