How does a read / write snapshot handle changes / deletions?

Reading a snapshot of a record will redirect any changes / updates to new blocks. It's easy to see how this might work if data needs to be added, but what if the data in the block changes or gets deleted? Since a snapshot block cannot be changed, how is information about what changed or deleted applied? It can't just be metadata from here, right? This will really slow things down if the data will be used for analysis.

+3


source to share


1 answer


You usually use a layered filesystem. Each snapshot creates a new layer, and when you request file metadata / file data, you are requesting the top layer, which will delegate to the lower layer if there is no request data in the current layer.

When you delete a file, you just put the top level xxx file, which is deleted. when you modify a block, you create a new block at the top level with metadata referencing one block in the new layer, delegating another to a lower level.

This seems to work like docker, and to go a little deeper, you can check this link, for example:



https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/#how-container-reads-and-writes-work-with-overlay-or-overlay2

https://docs.docker.com/engine/userguide/storagedriver/btrfs-driver/#how-the-btrfs-storage-driver-works

0


source







All Articles