What happens if we delete a file in HDFS with replication factor as 3?
Hello Friends,
In this post let's try to understand that what happens if we delete a file in HDFS with replication factor as 3 with below use cases :
Use Case 1: When trash property is not enabled?
When we delete a file from HDFS, it removes the metadata pointing to the blocks that is stored in NameNode. As there will be no reference to the blocks in metadata so they are deleted completely.
Use Case 2: When trash property is enabled?
In this case the file is moved in Trash directory so we can recover that file for a specific duration that was configured using "fs.trash.interval" in core-site.xml.
Use Case 3: When trash property is enabled and using -skipTrash parameter when deleting the file?
In this case the files are also deleted from trash as well, so no snapshot is present for that file i.e. there will be no reference to the blocks of that file to NameNode metadata. So the file will be removed completely.
Hope you enjoyed while reading these optimization tips. If you like then please Like, Comment and Share.
Thank You!
Comments
Post a Comment