Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fedomn/tx-coordinator
Transaction Coordinator for SQL execution in different database
https://github.com/fedomn/tx-coordinator
Last synced: 2 months ago
JSON representation
Transaction Coordinator for SQL execution in different database
- Host: GitHub
- URL: https://github.com/fedomn/tx-coordinator
- Owner: Fedomn
- License: apache-2.0
- Created: 2021-10-11T06:07:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-06T14:52:12.000Z (over 2 years ago)
- Last Synced: 2024-10-13T04:44:51.680Z (3 months ago)
- Language: Rust
- Size: 51.8 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tx-coordinator
Transaction Coordinator for SQL execution in different database
## Features
- guaranteed different database statements in a logic transaction
- each database only used one connection to execute multiple sql files## Install
download binary from [release](https://github.com/Fedomn/tx-coordinator/releases)
## Usage
```shell
./txcoordinator --cfg ./cfg.toml --dir ./sqlfiles
```### cfg.toml example
```yaml
[[databases]]
schema = "db1"
secret = "postgres://postgres:@127.0.0.1/db1"[[databases]]
schema = "db2"
secret = "postgres://postgres:@127.0.0.1/db2"[[databases]]
schema = "db3"
secret = "postgres://postgres:@127.0.0.1/db3"
```### sqlfiles example
filename pattern: `{sql_index}-{database_name}-{table_name}.sql`
```sql
0-db1-t0.sql
1-db1-t1.sql
0-db2-t.sql
0-db3-t.sql
```It groups sqlfiles using `database_name` and executes sql in ascending order of `sql_index`. In above example, the ececution order of db1 is *0-db1-t0.sql, 1-db1-t1.sql*
## Simulation operation
- `make db` to start integrated PostgreSQL
- `make simulate` to simulate real environment rollback operation