Grokking the Advanced System Design Interview
Ask Author
Back to course home

0% completed

Garbage Collection

Let's learn how GFS implements garbage collection.

Garbage collection through lazy deletion

When a file is deleted, GFS does not immediately reclaim the physical space used by that file. Instead, it follows a lazy garbage collection strategy. When the client issues a delete file operation, GFS does two things:

  1. The master logs the deletion operation just like other changes.
  2. The deleted file is renamed to a hidden name that also includes a deletion timestamp.

The file can still be read under the new, special name and can also be undeleted by renaming it back to normal




Like the course? Get enrolled and start learning!