Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Drop database doesn't remove HDFS directory.

Drop database doesn't remove HDFS directory.

Explorer

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

Re: Drop database doesn't remove HDFS directory.

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

Don't have an account?
Coming from Hortonworks? Activate your account here