Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doyensec/db-race-conditions-playground
Database Race Condition Playground. Made with ๐งก by Doyensec LLC.
https://github.com/doyensec/db-race-conditions-playground
database mariadb mysql postgres race-conditions transactions
Last synced: 27 days ago
JSON representation
Database Race Condition Playground. Made with ๐งก by Doyensec LLC.
- Host: GitHub
- URL: https://github.com/doyensec/db-race-conditions-playground
- Owner: doyensec
- Created: 2024-07-09T18:25:49.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-11T10:19:55.000Z (7 months ago)
- Last Synced: 2024-11-11T18:14:53.582Z (3 months ago)
- Topics: database, mariadb, mysql, postgres, race-conditions, transactions
- Language: JavaScript
- Homepage:
- Size: 45.9 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Database Race Conditions - Playground
This is a companion repository to the [A Race to the Bottom](https://blog.doyensec.com/2024/07/11/database-race-conditions.html) blog post. It contains sample apps and database Docker images to help you set up a playground an experiment with database transactions and concurrency control.
## 1. Building Database Images
Build a Postgres image:
```bash
# build image
make build-pg# run image
make run-pg# stop image
make stop-pg
```Build a MySQL image:
```bash
# build image
make build-mysql# run image
make run-mysql# stop image
make stop-mysql
```Build a Maria image:
```bash
# build image
make build-maria# run image
make run-maria# stop image
make stop-maria
```## 2. Set up your Environment
The environment can be set using the `.env` file:
```bash
DB="pg|mysql|maria"
HTTP2="true|false"
ISOLATION="0|1|2|3"
```The isolation levels map in the following way:
- 0 => `Read Uncommitted`
- 1 => `Read Committed`
- 2 => `Repeatable Read`
- 3 => `Serializable`The environment can be then be sourced to your environment using:
```bash
export $(cat .env| xargs)
```## 3. Run the Application
Build and run the Go application with:
```bash
# build
make build-go# run
make run-go
```Build and run the Node application with:
```bash
# build
make build-node# run
make run-node
```