In this project, we present an abstract implementation of 2PC, extended with failure handling. Nodes are implemented as thread objects, and messages are transfered in queue objects. We simulate the messenge delays by assuming an internal clock for each node.
Dian Chen, dc44632, dchen
Ruei-Bang Chen, rc46658, rbchen
Changan Chen, cc68838, changan
python (>=3.7)
We implemented the termination protocol and the loggings to handle node crash failures, link failures, and network partitions.
algo/nodes.py
contains the code for the participant and coordinator logic for 2PC, including part of the logging and the termination protocol logic.algo/messages.py
implements messages, includingVoteReq
,Vote
,DecisionReq
,Commit
andAbort
.algo/tasks.py
implements nodes' tasks such as node crashes and recovery.tests
contains our unittest code. There are 8 testing scenarios, 5 of which test for node crash failures, 1 tests for link failures, and 1 test for network partition.
To run the tests, run python -m tests -v
.