Question 17: Challenge snapshot
Ram is an avid runner and has built an app for his runner friends to challenge each other. Any user can send a challenge to any other user using the app. For fault tolerance reasons, he wants to take periodic snapshots of the state of his app. That is, he wants to a consistent view of all the send and received challenges as well as any in-flight challenges.
The challenge (pun intended) he is facing in getting a snapshot is that while each user's app can snapshot their local state, he is not sure how to guarantee a globally consistent snapshot. For example, consider that Ram sends a challenge to Shyam. If Ram takes a snapshot after sending the challenge and Shyam takes a snapshot after receiving the challenge, the snapshot would imply that Ram send Shyam two challenge (out of which one is in-flight in the snapshot).
Can you suggest a mechanism to get a globally consistent snapshot?
Solution coming up in the next post!
Solution for silent data corruption:
Naina can introduce scrubbing to increase the reliability of her storage system. A background task can periodically read all (or a randomly chosen subset) of the data to check that it is not corrupted. If the data is found to be corrupted, the scrubber can reconstruct the data from the replica (assuming that the replica is not corrupted).