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

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

Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/359#discussion_r222448618
  
    --- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java 
---
    @@ -0,0 +1,169 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.phoenix.end2end;
    +
    +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
    +import static org.junit.Assert.assertTrue;
    +import static org.junit.Assert.assertFalse;
    +import static org.junit.Assert.fail;
    +
    +import java.sql.Connection;
    +import java.sql.DriverManager;
    +import java.sql.ResultSet;
    +import java.util.Arrays;
    +import java.util.Collection;
    +
    +import org.apache.hadoop.hbase.HConstants;
    +import org.apache.hadoop.hbase.TableName;
    +import org.apache.phoenix.coprocessor.TableViewFinderResult;
    +import org.apache.phoenix.coprocessor.ViewFinder;
    +import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
    +
    +import org.apache.phoenix.query.QueryServices;
    +import org.apache.phoenix.query.QueryServicesOptions;
    +import org.apache.phoenix.schema.PTable;
    +import org.apache.phoenix.schema.TableNotFoundException;
    +import org.apache.phoenix.util.PhoenixRuntime;
    +import org.apache.phoenix.util.SchemaUtil;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.junit.runners.Parameterized;
    +import org.junit.runners.Parameterized.Parameters;
    +
    +@RunWith(Parameterized.class)
    +public class DropTableWithViewsIT extends SplitSystemCatalogIT {
    +
    +    private final boolean isMultiTenant;
    +    private final boolean columnEncoded;
    +    private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + 
TENANT_ID_ATTRIB + "=" + TENANT1;
    +    
    +    public DropTableWithViewsIT(boolean isMultiTenant, boolean 
columnEncoded) {
    +        this.isMultiTenant = isMultiTenant;
    +        this.columnEncoded = columnEncoded;
    +    }
    +    
    +    @Parameters(name="DropTableWithViewsIT_multiTenant={0}, 
columnEncoded={1}") // name is used by failsafe as file name in reports
    +    public static Collection<Boolean[]> data() {
    +        return Arrays.asList(new Boolean[][] { 
    +                { false, false }, { false, true },
    +                { true, false }, { true, true } });
    +    }
    +
    +    private String generateDDL(String format) {
    +        return generateDDL("", format);
    +    }
    +    
    +    private String generateDDL(String options, String format) {
    +        StringBuilder optionsBuilder = new StringBuilder(options);
    +        if (!columnEncoded) {
    +            if (optionsBuilder.length()!=0)
    +                optionsBuilder.append(",");
    +            optionsBuilder.append("COLUMN_ENCODED_BYTES=0");
    +        }
    +        if (isMultiTenant) {
    +            if (optionsBuilder.length()!=0)
    +                optionsBuilder.append(",");
    +            optionsBuilder.append("MULTI_TENANT=true");
    +        }
    +        return String.format(format, isMultiTenant ? "TENANT_ID VARCHAR 
NOT NULL, " : "",
    +            isMultiTenant ? "TENANT_ID, " : "", optionsBuilder.toString());
    +    }
    +    
    +    @Test
    +    public void testDropTableWithChildViews() throws Exception {
    --- End diff --
    
    The test looks pretty big. Do you want it to split this into multiple tests 
or move some code into `before`and `after` test methods?


> 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