Skip to content

v3.0.1: Final Assignment 3 Submission & Demo Video

Choose a tag to compare

@Pushkar111 Pushkar111 released this 05 Apr 11:39
· 58 commits to main since this release

Assignment 3: Custom ACID Engine and Concurrency Stress Testing

This release marks the final completion of CS432 Track 1 Assignment 3. We took our B+ tree from the last assignment and built a full database transaction engine on top of it from scratch, and also fixed the race conditions in our live API.

Demo Video: https://youtu.be/oKl7505LjB8

What we built for Module A (The Transaction Engine)

  • We wrote a complete Write-Ahead Log (WAL) mechanism in Python that forces an os.fsync to disk before doing anything in memory, so it is actually crash-safe.
  • We built a TransactionManager with a LIFO undo stack. If a transaction fails halfway, it rolls back everything cleanly in reverse order.
  • We added a RecoveryManager that reads the log file on startup and replays the committed transactions back into the B+ tree.
  • We included a ConsistencyChecker that verifies the internal structure of all the trees after every test to make sure no pointers broke.
  • We proved all four ACID properties across three different tables (Member, PersonVisit, GateOccupancy) working in a single transaction in our jupyter notebook.

What we fixed and tested in Module B (Stress Testing)

  • We found a real race condition bug in the entry endpoint and fixed it by adding SELECT FOR UPDATE to the query, which locks the row in PostgreSQL.
  • To prove it works, we wrote a script that fires 50 threads at the exact same endpoint at the exact same time. Exactly 1 thread wins and creates the entry, and the other 49 get rejected with no data corruption.
  • We wrote a failure testing script that runs 4 different error scenarios (like scanning a dead card or duplicate visits). All of them pass without writing partial data to the database.
  • We ran a load test using Locust with 50 concurrent users and sustained around 28 to 30 requests per second with zero server crashes.

Repository structure

We kept the work split across 6 branches so the git history is clean:

  • chore/a3-baseline
  • feat/a3-module-a-transactions
  • test/a3-module-a-notebook
  • fix/a3-module-b-race-condition
  • test/a3-module-b-harness
  • feat/a3-updated-requirements

Course: CS 432 Databases, Semester II 2025-2026, IIT Gandhinagar
Team: Lumos
Deadline: 5 April 2026