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

Jesus Camacho Rodriguez commented on HIVE-18991:
------------------------------------------------

[~alangates], uploaded a new patch that brings the code in 
{{HiveMetaStoreClient}} back. If I understand that logic correctly, I think we 
should not handle the drop database statement from the client in that fashion. 
The reason is that triggering individual drop statements for each table from 
the client may lead to dropping only some tables, while some other tables and 
the database are not dropped (no rollback). I did not change any logic right 
now, but I left a note in the code.

Concerning dropping tables that are referenced by MVs, I realized that it 
should not be an issue since we will get the foreign key violation that you 
were seeing when you opened this case. As a follow-up work, we should probably 
print an understandable message instead of the constraint violation sent by 
metastore db.

> Drop database cascade doesn't work with materialized views
> ----------------------------------------------------------
>
>                 Key: HIVE-18991
>                 URL: https://issues.apache.org/jira/browse/HIVE-18991
>             Project: Hive
>          Issue Type: Bug
>          Components: Materialized views, Metastore
>    Affects Versions: 3.0.0
>            Reporter: Alan Gates
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>         Attachments: HIVE-18991.01.patch, HIVE-18991.patch
>
>
> Create a database, add a table and then a materialized view that depends on 
> the table.  Then drop the database with cascade set.  Sometimes this will 
> fail because when HiveMetaStore.drop_database_core goes to drop all of the 
> tables it may drop the base table before the materialized view, which will 
> cause an integrity constraint violation in the RDBMS.  To resolve this that 
> method should change to fetch and drop materialized views before tables.
> cc [~jcamachorodriguez]



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

Reply via email to