Reply
Explorer
Posts: 21
Registered: ‎12-13-2016

Drop database doesn't remove HDFS directory.

When I run the drop database command within impala it doesn't remove the corresponding HDFS files.

 

               drop database if exists databasename cascade;

 

I want to drop a database and remove the corresponding hdfs files.

 

Per the documentaion - 

DROP DATABASE Statement

Removes a database from the system.

The physical operations involve removing the metadata for the database from the metastore, and deleting the corresponding *.db directory from HDFS.

 

The cascade parameter drops the tables within the database first.

 

I'm running CDH 513.3 and CM 514.3.

Highlighted
Posts: 519
Topics: 14
Kudos: 90
Solutions: 45
Registered: ‎09-02-2016

Re: Drop database doesn't remove HDFS directory.

@DanielWhite

 

I had the similar issue long back and below was my findings

 

Please check the owner of HDFS folder/files for the corresponding db that you are trying to delete. if you are the owner and trying to delete the table/db from hive/impala, it will delete both metadata and hdfs file/folder. Whereas you are not the owner of hdfs folder/file but got an access in hive/impala to manage data and trying to delete it, it will just delete the metadata but not the underlined folder/files from hdfs

 

pls try this with a sample db/table for more understanding

Announcements