[ 
https://issues.apache.org/jira/browse/PHOENIX-5545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chinmay Kulkarni updated PHOENIX-5545:
--------------------------------------
    Description: 
1) Start the HBase server with 4.15.0 Phoenix
2) Connect with a 4.15.0 client
3) Create a base table and a view on top of the base table and create an index 
on top of this view:
{code:sql}
CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, HOST 
VARCHAR(10), FLAG BOOLEAN);

CREATE VIEW Z_VIEW1 (col1 INTEGER, col2 INTEGER, col3 INTEGER, col4 INTEGER, 
col5 INTEGER) AS SELECT * FROM Z_BASE_TABLE WHERE ID>10;

CREATE INDEX V_I ON Z_VIEW1(COL4);
{code}

4) Drop the base table with the cascade option:
{code:sql}
DROP TABLE Z_BASE_TABLE CASCADE;
{code}

5) DropChildViewsTask gets added to the SYSTEM.TASK table as expected, but when 
it gets scheduled and subsequently executed, it fails with the following 
exception:
{code:java}
2019-10-24 22:44:34,214 ERROR [pool-121-thread-1] tasks.DropChildViewsTask: 
Exception while dropping a child view task. null.Z_BASE_TABLE with tenant id  
IS NULL and timestamp 292278994-08-16 23:12:55.807
org.apache.phoenix.exception.PhoenixIOException: Z_BASE_TABLE
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4442)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushParentPhysicalTable(ConnectionQueryServicesImpl.java:1922)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.dropTable(ConnectionQueryServicesImpl.java:1888)
        at 
org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3152)
        at 
org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3060)
        at org.apache.phoenix.util.ViewUtil.dropChildViews(ViewUtil.java:207)
        at 
org.apache.phoenix.coprocessor.tasks.DropChildViewsTask.run(DropChildViewsTask.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.phoenix.coprocessor.TaskRegionObserver$SelfHealingTask.run(TaskRegionObserver.java:204)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.hadoop.hbase.TableNotFoundException: Z_BASE_TABLE
        at 
org.apache.hadoop.hbase.client.HBaseAdmin.checkTableExists(HBaseAdmin.java:2863)
        at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1904)
        at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1949)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4440)
        ... 18 more
{code}

Note that this marks the DropChildViews task for the base table as failed and 
so *if the base table has any other views, those views will also not be 
dropped*.

  was:
1) Start the HBase server with 4.15.0 Phoenix
2) Connect with a 4.15.0 client
3) Create a base table and a view on top of the base table and create an index 
on top of this view:
{code:sql}
CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, HOST 
VARCHAR(10), FLAG BOOLEAN);

CREATE VIEW Z_VIEW1 (col1 INTEGER, col2 INTEGER, col3 INTEGER, col4 INTEGER, 
col5 INTEGER) AS SELECT * FROM Z_BASE_TABLE WHERE ID>10;

CREATE INDEX V_I ON Z_VIEW1(COL4);
{code}

4) Drop the base table with the cascade option:
{code:sql}
DROP TABLE Z_BASE_TABLE CASCADE;
{code}

5) DropChildViews Task gets added to the SYSTEM.TASK table as expected, but 
when it gets scheduled and subsequently executed, it fails with the following 
exception:
{code:java}
2019-10-24 22:44:34,214 ERROR [pool-121-thread-1] tasks.DropChildViewsTask: 
Exception while dropping a child view task. null.Z_BASE_TABLE with tenant id  
IS NULL and timestamp 292278994-08-16 23:12:55.807
org.apache.phoenix.exception.PhoenixIOException: Z_BASE_TABLE
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4442)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushParentPhysicalTable(ConnectionQueryServicesImpl.java:1922)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.dropTable(ConnectionQueryServicesImpl.java:1888)
        at 
org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3152)
        at 
org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3060)
        at org.apache.phoenix.util.ViewUtil.dropChildViews(ViewUtil.java:207)
        at 
org.apache.phoenix.coprocessor.tasks.DropChildViewsTask.run(DropChildViewsTask.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.phoenix.coprocessor.TaskRegionObserver$SelfHealingTask.run(TaskRegionObserver.java:204)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.hadoop.hbase.TableNotFoundException: Z_BASE_TABLE
        at 
org.apache.hadoop.hbase.client.HBaseAdmin.checkTableExists(HBaseAdmin.java:2863)
        at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1904)
        at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1949)
        at 
org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4440)
        ... 18 more
{code}

Note that this marks the DropChildViews task for the base table as failed and 
so *if the base table has any other views, those views will also not be 
dropped*.


> DropChildViews Task fails for a base table when its child view has an index
> ---------------------------------------------------------------------------
>
>                 Key: PHOENIX-5545
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5545
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.15.0, 5.1.0
>            Reporter: Chinmay Kulkarni
>            Priority: Major
>             Fix For: 4.15.0, 5.1.0
>
>
> 1) Start the HBase server with 4.15.0 Phoenix
> 2) Connect with a 4.15.0 client
> 3) Create a base table and a view on top of the base table and create an 
> index on top of this view:
> {code:sql}
> CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, 
> HOST VARCHAR(10), FLAG BOOLEAN);
> CREATE VIEW Z_VIEW1 (col1 INTEGER, col2 INTEGER, col3 INTEGER, col4 INTEGER, 
> col5 INTEGER) AS SELECT * FROM Z_BASE_TABLE WHERE ID>10;
> CREATE INDEX V_I ON Z_VIEW1(COL4);
> {code}
> 4) Drop the base table with the cascade option:
> {code:sql}
> DROP TABLE Z_BASE_TABLE CASCADE;
> {code}
> 5) DropChildViewsTask gets added to the SYSTEM.TASK table as expected, but 
> when it gets scheduled and subsequently executed, it fails with the following 
> exception:
> {code:java}
> 2019-10-24 22:44:34,214 ERROR [pool-121-thread-1] tasks.DropChildViewsTask: 
> Exception while dropping a child view task. null.Z_BASE_TABLE with tenant id  
> IS NULL and timestamp 292278994-08-16 23:12:55.807
> org.apache.phoenix.exception.PhoenixIOException: Z_BASE_TABLE
>       at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4442)
>       at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.flushParentPhysicalTable(ConnectionQueryServicesImpl.java:1922)
>       at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.dropTable(ConnectionQueryServicesImpl.java:1888)
>       at 
> org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3152)
>       at 
> org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:3060)
>       at org.apache.phoenix.util.ViewUtil.dropChildViews(ViewUtil.java:207)
>       at 
> org.apache.phoenix.coprocessor.tasks.DropChildViewsTask.run(DropChildViewsTask.java:60)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.apache.phoenix.coprocessor.TaskRegionObserver$SelfHealingTask.run(TaskRegionObserver.java:204)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.hadoop.hbase.TableNotFoundException: Z_BASE_TABLE
>       at 
> org.apache.hadoop.hbase.client.HBaseAdmin.checkTableExists(HBaseAdmin.java:2863)
>       at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1904)
>       at org.apache.hadoop.hbase.client.HBaseAdmin.flush(HBaseAdmin.java:1949)
>       at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.flushTable(ConnectionQueryServicesImpl.java:4440)
>       ... 18 more
> {code}
> Note that this marks the DropChildViews task for the base table as failed and 
> so *if the base table has any other views, those views will also not be 
> dropped*.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to