---
# System prepended metadata

title: DB test

---

# DB test
To test the consistency of real databases.
We generate the anomaly history, and simulate multi-users transcation reqeusting to databases.

### Branch
3TS dev-consistency-check

### Databases environment

In case you are new to install databases, we provide some setup steps for installing databases for testing. Then our program will request query by ODBC connector via IP and Ports.


### Compile the code
To generate Makefile (all commands are executed under '3TS/src/dbtest'):
```
cmake -S ./
```

To complie the code:
```
make
```


### Test Cases
For test cases, it specify in "do_test_list.txt". Use "#" to exclude (comment) the test case.
We provide three levels of test cases, i.e., the basic cases (33 anomalies in the paper), the predicate cases, and the MDA cases (with multiple transactions and objects). For specific test cases to evaluate, we specify it in do_test_list.txt. 

```
// to test all test cases
cp t/bk_do_test_list_all.txt do_test_list.txt 

// to test only basic cases
cp t/bk_do_test_list_basic.txt do_test_list.txt 
```

### To test the databases:
Edit "auto_test.sh" for database configurations (e.g., username, password). Edit "auto_test_all.sh" for databse (e.g., PostgreSQL, and MySQL) and isolation (e.g., SERIALIZABLE, REPEATABLE READ, READ COMMITTED, and READ UNCOMMITTED) configuration.


To run the test (under '3TS/src/dbtest'):
```
./auto_test_all.sh
```




The anomaly test cases are Write-read Skew and Write-read Skew Committed, the schedules are as follows:

Write-read Skew : <img src="https://render.githubusercontent.com/render/math?math=W_1[x_1]W_2[y_1]R_2[x_1]R_1[y_1]">

Write-read Skew Committed : <img src="https://render.githubusercontent.com/render/math?math=W_1[x_1]W_2[y_1]R_2[x_1]C_2R_1[y_1]">




