Act as a database reliability engineer. Build The Database Deadlock Scenario Playground, an interactive simulator that teaches developers how transaction ordering creates deadlocks.
Users should be able to create transactions, define resources, specify lock modes, and configure the order in which resources are acquired and released.
Implement:
A step-by-step transaction scheduler.
A live wait-for graph showing which transaction is waiting for another.
Deadlock detection using cycles in the wait-for graph.
Controls for interleaving transaction operations.
Demonstrations of inconsistent lock ordering, long-held locks, and competing updates.
Comparison of possible fixes, including consistent lock ordering, shorter transactions, and retry policies.
A timeline showing lock acquisition, waiting, release, rollback, and retry.
Exportable scenarios and explanations.
Include prebuilt examples inspired by bank transfers, inventory reservations, and concurrent editing. Make the simulation deterministic and clearly explain its assumptions. Do not connect to or modify a real database. Deliver a genuinely interactive learning environment rather than a static diagram.
0 Comments