I am reading the Designing Data Intensive Application
book. In chapter 8, it discusses the use of Fencing Token for preventing concurrent writes to a network file.
The mechanism states that the a Lock service can give out Fencing Tokens, and the Storage Node checks it and rejects lower tokens given by a node whose lock lease has expired. In the particular example, it talked about the case where the node experienced a long GC pause, then tries to write to storage using a stale fencing token.
I am curious about a scenario where the node sends a fencing token which is accepted by the storage node, and writes some data into the storage, then it experienced a long pause which causes the lease to expire. In such a case, would this already leave the network file in a corrupted state? If so, how can this be prevented?
I guess a similar question in nature is - what happens when distributed lock lease expires while a resource is being modified? Does the client automatically extend the lease?
Thanks!