Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Drop database doesn't remove HDFS directory.

avatar
Contributor

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.

1 REPLY 1

avatar
Champion

@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