https://github.com/henryqingmo/distributed-transaction
Distributed transaction system using strict two-phase locking (2PL), wound-wait deadlock prevention, and two-phase commit (2PC) to provide isolation and atomicity across multiple servers.
https://github.com/henryqingmo/distributed-transaction
2-phase-commit 2-phase-locking concensus distributed-systems go
Last synced: 18 days ago
JSON representation
Distributed transaction system using strict two-phase locking (2PL), wound-wait deadlock prevention, and two-phase commit (2PC) to provide isolation and atomicity across multiple servers.
- Host: GitHub
- URL: https://github.com/henryqingmo/distributed-transaction
- Owner: henryqingmo
- Created: 2026-04-23T03:54:58.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-05T22:58:22.000Z (about 1 month ago)
- Last Synced: 2026-05-05T23:27:52.328Z (about 1 month ago)
- Topics: 2-phase-commit, 2-phase-locking, concensus, distributed-systems, go
- Language: Go
- Homepage:
- Size: 3.76 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MP3 — Distributed Transactions
Two-phase locking (2PL) for isolation and two-phase commit (2PC) for atomicity across branch servers.
## Build
```bash
make
```
Produces `mp3/server` and `mp3/client`.
## Config file
Each line names a branch and its host/port:
```
A sp26-cs425-3701.cs.illinois.edu 1234
B sp26-cs425-3702.cs.illinois.edu 1234
C sp26-cs425-3703.cs.illinois.edu 1234
D sp26-cs425-3704.cs.illinois.edu 1234
E sp26-cs425-3705.cs.illinois.edu 1234
```
## Running a server
```bash
./mp3/server
# e.g.
./mp3/server A config.txt
```
Start one process per branch. Each server listens on the port from the config file.
## Running the client
```bash
./mp3/client
# e.g.
./mp3/client foo config.txt
```
The client connects to a randomly selected server as coordinator and reads commands from stdin.
### Client commands
```
BEGIN
DEPOSIT .
WITHDRAW .
BALANCE .
COMMIT
ABORT
```
## Local test
```bash
cd sample_test
./run.sh
```
Starts five servers on ports 10001–10005, runs two test cases, and diffs output against expected results.