You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Ankit Singhal (JIRA)" <ji...@apache.org> on 2016/06/07 18:15:21 UTC

[jira] [Created] (PHOENIX-2973) Table can not be dropped if Local Index is created on view on multi-tenant table

Ankit Singhal created PHOENIX-2973:
--------------------------------------

             Summary: Table can not be dropped if Local Index is created on view on multi-tenant table
                 Key: PHOENIX-2973
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2973
             Project: Phoenix
          Issue Type: Bug
            Reporter: Ankit Singhal
            Assignee: Rajeshbabu Chintaguntla


Table can not be dropped(even with CASCADE option) if Local Index is created on view on multi-tenant table.

Create multi-tenant table.
{code}
bin/sqlline.py "localhost"

CREATE TABLE MT_BASE (PK1 VARCHAR not null, PK2 VARCHAR not null, MYCF1.COL1 varchar,MYCF2.COL2 varchar CONSTRAINT pk PRIMARY KEY(PK1,PK2)) MULTI_TENANT=true;
UPSERT INTO MT_BASE values ('a','b','c','d');
CREATE VIEW acme AS SELECT * FROM MT_BASE;
{code}

Create local index with TenantId=a
{code}
bin/sqlline.py "localhost;TenantId=a"

CREATE VIEW acme AS SELECT * FROM MT_BASE;
create local index idx_acme on acme (COL1);
{code}

Try dropping a table,following exception will come
{code}
bin/sqlline.py "localhost"

0: jdbc:phoenix:localhost> drop table mt_base cascade;
Error: ERROR 1012 (42M03): Table undefined. tableName=MT_BASE (state=42M03,code=1012)
org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=MT_BASE
	at org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:2555)
	at org.apache.phoenix.schema.MetaDataClient.dropTable(MetaDataClient.java:2475)
	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableDropTableStatement$1.execute(PhoenixStatement.java:888)
	at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:343)
	at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:1)
	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:330)
	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1440)
	at sqlline.Commands.execute(Commands.java:822)
	at sqlline.Commands.sql(Commands.java:732)
	at sqlline.SqlLine.dispatch(SqlLine.java:807)
	at sqlline.SqlLine.begin(SqlLine.java:681)
	at sqlline.SqlLine.start(SqlLine.java:398)
	at sqlline.SqlLine.main(SqlLine.java:292)
{code}

Table can be drop only when all the views are dropped separately by opening connection with each tenantId.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)