Skip to content

Transaction Coordinator for SQL execution in different database

License

Notifications You must be signed in to change notification settings

Fedomn/tx-coordinator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Usage

./txcoordinator --cfg ./cfg.toml --dir ./sqlfiles

cfg.toml example

[[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

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

About

Transaction Coordinator for SQL execution in different database

Resources

License

Stars

Watchers

Forks

Packages

No packages published