Skip to content

Commit 0dbd7be

Browse files
committed
add some details in README
1 parent 782dd4f commit 0dbd7be

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ make && make install
2323
```bash
2424
cd ~/code/pg_dtm/dtmd
2525
make
26+
mkdir /tmp/clog
2627
./bin/dtmd &
2728
```
28-
* To run something meaningful you need at leat two postgres instances. Also pg_dtm requires
29+
* To run something meaningful you need at leat two postgres instances. Also pg_dtm requires presense in ```shared_preload_libraries```.
2930
```bash
3031
initdb -D ./install/data1
3132
initdb -D ./install/data2
@@ -42,19 +43,22 @@ For a cluster-wide deploy we use ansible, more details in tests/deploy_layouts.
4243

4344
### Usage
4445

45-
Now cluster is running and you can use global tx between two nodes.
46-
46+
Now cluster is running and you can use global tx between two nodes. Let's connect to postgres instances at different ports:
4747

4848
```sql
4949
create extension pg_dtm; -- node1
50+
create table accounts(user_id int, amount int); -- node1
51+
insert into accounts (select 2*generate_series(1,100)-1, 0); -- node1, odd user_id's
5052
create extension pg_dtm; -- node2
53+
create table accounts(user_id int, amount int); -- node2
54+
insert into accounts (select 2*generate_series(1,100), 0); -- node2, even user_id's
5155
select dtm_begin_transaction(); -- node1, returns global xid, e.g. 42
5256
select dtm_join_transaction(42); -- node2, join global tx
5357
begin; -- node1
5458
begin; -- node2
5559
update accounts set amount=amount-100 where user_id=1; -- node1, transfer money from user#1
5660
update accounts set amount=amount+100 where user_id=2; -- node2, to user#2
57-
commit; -- node1
61+
commit; -- node1, blocks until second commit happend
5862
commit; -- node2
5963
```
6064

@@ -63,7 +67,7 @@ commit; -- node1
6367
To ensure consistency we use simple bank test: perform a lot of simultaneous transfers between accounts on different servers, while constantly checking total amount of money on all accounts. This test can be found in tests/perf.
6468

6569
```bash
66-
> go run ./perf/*
70+
> go run ./tests/perf/*
6771
-C value
6872
Connection string (repeat for multiple connections)
6973
-a int
@@ -87,14 +91,14 @@ To ensure consistency we use simple bank test: perform a lot of simultaneous tra
8791
8892
So previous installation can be initialized with:
8993
```
90-
go run ./perf/*.go \
94+
go run ./tests/perf/*.go \
9195
-C "dbname=postgres port=5432" \
9296
-C "dbname=postgres port=5433" \
9397
-g -i
9498
```
9599
and tested with:
96100
```
97-
go run ./perf/*.go \
101+
go run ./tests/perf/*.go \
98102
-C "dbname=postgres port=5432" \
99103
-C "dbname=postgres port=5433" \
100104
-g

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy