2Phase Lock in Distributed Database:
In this protocol, it is required that all the data items must be reached in a mutually independent manner, i.e. when one transaction is performing, then no other transaction should interrupt the process.
It requires both locks and unlocks being done in two phases:
- Growing Phase: Obtain locks that means when we are writing something on A and B, then we will take locks on A and B like below: W(A) and W(B)
- Shrinking Phase: Release locks, Unlock the objects in a row like unlock (A) and unlock (B)
But 2 PL won’t be able to solve other problems such as cascading rollback.