Skip to content

Commit ad57f55

Browse files
committed
Merge branch 'master' of gitlab.postgrespro.ru:s.kelvich/pg_tsdtm
2 parents c752b79 + d21ad66 commit ad57f55

File tree

6 files changed

+17
-29
lines changed

6 files changed

+17
-29
lines changed

pg_dtm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ static TransactionId DtmAdjustOldestXid(TransactionId xid)
393393
DtmTransStatus *ts, *prev = NULL;
394394
timestamp_t cutoff_time = dtm_get_current_time() - DtmVacuumDelay*USEC;
395395
SpinLockAcquire(&local->lock);
396+
ts = (DtmTransStatus*)hash_search(xid2status, &xid, HASH_FIND, NULL);
397+
if (ts != NULL) {
398+
cutoff_time = ts->cid - DtmVacuumDelay*USEC;
399+
}
396400
for (ts = local->trans_list_head; ts != NULL && ts->cid < cutoff_time; prev = ts, ts = ts->next) {
397401
if (prev != NULL) {
398402
hash_search(xid2status, &prev->xid, HASH_REMOVE, NULL);

tests/deploy/cluster.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
pg_version_tag: xtm_patched
1111
pg_destroy_and_init: true
1212
pg_datadir: ./postgrespro-data
13+
pg_config_role:
14+
- line: "dtm.vacuum_delay=60"
1315

1416
tasks:
1517

tests/deploy/roles/postgres/vars/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pg_config:
2222
- line: "fsync = off"
2323
- line: "autovacuum = off"
2424
- line: "listen_addresses = '*'"
25-
- line: "max_connections = 512"
26-
- line: "max_prepared_transactions = 400"
25+
- line: "max_connections = 2048"
26+
- line: "max_prepared_transactions = 4000"
2727
- line: "port = {{pg_port}}"
2828
pg_config_role:
2929
- line: "#pg_config_role"

tests/deploy/tsdm.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
pg_destroy_and_init: true
1919
pg_datadir: ~/postgrespro-data2
2020

21-
- role: postgres
22-
pg_port: 5434
23-
pg_repo: https://github.com/kelvich/postgresql.git
24-
pg_version_tag: xtm_patched
25-
pg_destroy_and_init: true
26-
pg_datadir: ~/postgrespro-data3
27-
2821
tasks:
2922

3023
- name: clone dtm sources
@@ -54,19 +47,9 @@
5447
line: "shared_preload_libraries = 'pg_dtm'"
5548
state: present
5649

57-
- name: enable dtm extension on datanodes
58-
lineinfile:
59-
dest: "~/postgrespro-data3/postgresql.conf"
60-
regexp: "^shared_preload_libraries "
61-
line: "shared_preload_libraries = 'pg_dtm'"
62-
state: present
63-
6450
- name: restart postgrespro1
6551
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ~/postgrespro-data -l ~/postgrespro-data/pg.log"
6652

6753
- name: restart postgrespro2
68-
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ~/postgrespro-data2 -l ~/postgrespro-data/pg.log"
69-
70-
- name: restart postgrespro3
71-
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ~/postgrespro-data3 -l ~/postgrespro-data/pg.log"
54+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ~/postgrespro-data2 -l ~/postgrespro-data2/pg.log"
7255

tests/perf/transfers.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ func (t TransfersTS) writer(id int, cCommits chan int, cAborts chan int, wg *syn
6767

6868
gtid := strconv.Itoa(id) + "." + strconv.Itoa(i)
6969
amount := 2*rand.Intn(2) - 1
70-
from_acc := cfg.Writers.StartId + 2*id + 1
71-
to_acc := cfg.Writers.StartId + 2*id + 2
72-
70+
from_acc := rand.Intn(cfg.AccountsNum)//cfg.Writers.StartId + 2*id + 1
71+
to_acc := rand.Intn(cfg.AccountsNum)//cfg.Writers.StartId + 2*id + 2
72+
7373
conn1 := conns[rand.Intn(len(conns))]
7474
conn2 := conns[rand.Intn(len(conns))]
75-
if conn1 == conn2 {
76-
continue
75+
for conn1 == conn2 {
76+
conn1 = conns[rand.Intn(len(conns))]
77+
conn2 = conns[rand.Intn(len(conns))]
7778
}
7879

7980
exec(conn1, "begin transaction")

tests/run_perf.sh

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
go run perf/*.go \
22
-C "dbname=postgres port=5432 sslmode=disable" \
33
-C "dbname=postgres port=5433 sslmode=disable" \
4-
-C "dbname=postgres port=5434 sslmode=disable" \
5-
-g -w 8 -r 1 -n 1000 -a 10000 -i
4+
-g -w 64 -r 1 -n 10000 -a 10000 -i
65

76
go run perf/*.go \
87
-C "dbname=postgres port=5432 sslmode=disable" \
98
-C "dbname=postgres port=5433 sslmode=disable" \
10-
-C "dbname=postgres port=5434 sslmode=disable" \
11-
-g -w 8 -r 1 -n 1000 -a 10000
9+
-g -w 64 -r 1 -n 10000 -a 10000

0 commit comments

Comments
 (0)