When I delete data from hdfs if goes to .Trash.
I can either use
hdfs dfs -rm -skipTrash /path_to_directory
or use
hdfs dfs -expunge
to remove data already in .Trash
Two questions:
While dropping table in Hive - do the tables go to .Trash or they are removed permanently?
Is this possible to remove data from .Trash for all users? Assuming I have required privileges...
Pawel
You will find rm command in your Hadoop fs command. This command is similar to the Linux rm command, and it is used for removing a file from the HDFS file system. The command –rmr can be used to delete files recursively.
Log into the Hadoop NameNode using the database administrator's account and use HDFS's rmr command to delete the directories.
If the -skipTrash option is specified, the trash, if enabled, will be bypassed and the specified file(s) deleted immediately. This can be useful when it is necessary to delete files from an over-quota directory. Example: hdfs dfs -rmr /user/hadoop/dir.
If you are dropping an external table, nothing is going to happen as it doesn't delete any data.
For managed tables, yes all the data files will go to the .Trash directory of the user who ran the drop
command. However it's only data and not the metadata.
For other part of your question, yes you could delete the .Trash directory of any user if you have required privilege.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With