The corruption of the file system might be because of multiple reasons, such as software upgrades corrupting the filesystem, human errors or, bugs in the application. With the help of snapshots in HDFS, we can reduce the probable damage to the data in the system during such scenarios.
The snapshot mechanism helps to preserve the current state of the filesystem and enables administrators to roll back the namespace and storage states in the working condition.
HDFS can have only one existence of a snapshot with an optional configuration with the administrator to enable it during startup. If a snapshot is triggered, NameNode refers to the checkpoint and the journal file and merges them in the memory. It would now write a new checkpoint and an empty journal on to a new location, so the old checkpoint and journal remain unaffected.
During the handshake, NameNode pushes DataNodes to check whether a snapshot is to be created or not. A local snapshot in DataNode...