Skip to content

Commit edf5f00

Browse files
committed
Update ansible scripts to support dtmacid test
1 parent ba2b202 commit edf5f00

File tree

4 files changed

+73
-6
lines changed

4 files changed

+73
-6
lines changed

contrib/mmts/multimaster.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,6 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
426426
else
427427
{
428428
bool invisible = ts->status != TRANSACTION_STATUS_COMMITTED;
429-
if (invisible != PgXidInMVCCSnapshot(xid, snapshot)) {
430-
fprintf(stderr, "Change visibility for XID %d(csn=%ld, status=%d) in snapshot %ld [%d,%d]\n", xid, ts->csn, ts->status, MtmTx.snapshot, snapshot->xmin, snapshot->xmax);
431-
}
432429
MTM_LOG4("%d: tuple with xid=%d(csn= %ld) is %s in snapshot %ld",
433430
MyProcPid, xid, ts->csn, invisible ? "rollbacked" : "committed", MtmTx.snapshot);
434431
MtmUnlock();
@@ -459,7 +456,7 @@ MtmAdjustOldestXid(TransactionId xid)
459456
csn_t oldestSnapshot = INVALID_CSN;
460457
MtmTransState *prev = NULL;
461458
MtmTransState *ts = (MtmTransState*)hash_search(MtmXid2State, &xid, HASH_FIND, NULL);
462-
MTM_LOG1("%d: MtmAdjustOldestXid(%d): snapshot=%ld, csn=%ld, status=%d", MyProcPid, xid, ts != NULL ? ts->snapshot : 0, ts != NULL ? ts->csn : 0, ts != NULL ? ts->status : -1);
459+
MTM_LOG2("%d: MtmAdjustOldestXid(%d): snapshot=%ld, csn=%ld, status=%d", MyProcPid, xid, ts != NULL ? ts->snapshot : 0, ts != NULL ? ts->csn : 0, ts != NULL ? ts->status : -1);
463460
Mtm->gcCount = 0;
464461
if (ts != NULL) {
465462
oldestSnapshot = ts->snapshot;
@@ -492,7 +489,7 @@ MtmAdjustOldestXid(TransactionId xid)
492489
if (prev != NULL) {
493490
Mtm->transListHead = prev;
494491
Mtm->oldestXid = xid = prev->xid;
495-
MTM_LOG1("%d: MtmAdjustOldestXid: oldestXid=%d, olderstSnapshot=%ld", MyProcPid, xid, oldestSnapshot);
492+
MTM_LOG2("%d: MtmAdjustOldestXid: oldestXid=%d, olderstSnapshot=%ld", MyProcPid, xid, oldestSnapshot);
496493
} else if (TransactionIdPrecedes(Mtm->oldestXid, xid)) {
497494
xid = Mtm->oldestXid;
498495
}

contrib/mmts/tests/acid.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
3+
- hosts: nodes[-1]
4+
gather_facts: no
5+
tasks:
6+
7+
- name: create mm ext
8+
shell: >
9+
~/pg_cluster/install/bin/psql -p 15432 postgres -c "drop extension if exists multimaster";
10+
~/pg_cluster/install/bin/psql -p 15432 postgres -c "drop table if exists t";
11+
~/pg_cluster/install/bin/psql -p 15432 postgres -c 'create extension multimaster;';
12+
~/pg_cluster/install/bin/psql -p 15432 postgres -c 'create table t(u int primary key, v int);';
13+
14+
- hosts: clients
15+
gather_facts: no
16+
tasks:
17+
18+
- name: generate connstrings
19+
set_fact:
20+
connstr: "-c 'host={{item}} user={{ansible_ssh_user}} port=15432 dbname=postgres' "
21+
with_items:
22+
groups['nodes'] | reverse | batch(nnodes | d(1) | int) | first
23+
register: connstrs
24+
25+
- name: make a list
26+
set_fact:
27+
connections: "{{ connstrs.results | map(attribute='ansible_facts.connstr') | join }}"
28+
29+
- hosts: clients[0]
30+
gather_facts: no
31+
tasks:
32+
- name: init database
33+
shell: "~/pg_cluster/install/bin/dtmacid {{connections}} -a 100 -i"
34+
register: init_result
35+
environment:
36+
LD_LIBRARY_PATH: "/home/{{ansible_ssh_user}}/pg_cluster/install/lib"
37+
38+
- debug: var=init_result
39+
40+
- hosts: clients
41+
gather_facts: no
42+
tasks:
43+
44+
- local_action: shell echo "Bench started at `date`" >> perf.results
45+
46+
- name: run transfers
47+
shell: >
48+
~/pg_cluster/install/bin/dtmacid {{connections}}
49+
-w {{ nconns }} -w 4 -r 2 -n 100000 -a 100 |
50+
tee -a perf.results |
51+
sed "s/^/`hostname`:/"
52+
register: transfers_result
53+
environment:
54+
LD_LIBRARY_PATH: "/home/{{ansible_ssh_user}}/pg_cluster/install/lib"
55+
56+
- debug: var=transfers_result
57+
58+
- local_action: 'shell echo "{{transfers_result.stdout }}" >> perf.results'
59+
60+
- local_action: shell echo "Bench finished at `date`" >> perf.results

contrib/mmts/tests/deploy_layouts/cluster.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
copy: src=../{{item}} dest=~/{{item}} mode=0755
7171
with_items:
7272
- "dtmbench.cpp"
73+
- "dtmacid.cpp"
7374

7475
- name: clone pqxx
7576
git: repo=https://github.com/Ambrosys/pqxx.git
@@ -96,4 +97,11 @@
9697
- name: install dtmbench
9798
shell: "mv dtmbench ~/pg_cluster/install/bin/dtmbench"
9899

100+
- name: compile dtmacid
101+
shell: "g++ -g -Wall -O2 -o dtmacid dtmacid.cpp -lpqxx -lpq -pthread -L/home/{{ansible_ssh_user}}/pg_cluster/install/lib/ -I/home/{{ansible_ssh_user}}/pg_cluster/install/include/"
102+
103+
- name: install dtmacid
104+
shell: "mv dtmacid ~/pg_cluster/install/bin/dtmacid"
105+
106+
99107

contrib/mmts/tests/dtmacid.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,17 @@ void* reader(void* arg)
140140
assert((int)r1.size() == cfg.nAccounts && (int)r2.size() == cfg.nAccounts);
141141
for (int i=0; i < cfg.nAccounts; i++) {
142142
int diff = r1[i][0].as(int()) - r2[i][0].as(int());
143+
#if 0
143144
fprintf(out, "%d: %d %c %d - [%d,%d]->[%ld,%ld] (snapshot %ld, last CSN %ld) vs. [%d,%d]->[%ld,%ld] (snapshot %ld, last CSN %ld)\n",
144145
i, r1[i][0].as(int()), diff < 0 ? '<' : diff == 0 ? '=' : '>', r2[i][0].as(int()),
145146
r1[i][1].as(int()), r1[i][2].as(int()), r1[i][3].as(int64_t()), r1[i][4].as(int64_t()), r1[i][5].as(int64_t()), r1[i][6].as(int64_t()),
146147
r2[i][1].as(int()), r2[i][2].as(int()), r2[i][3].as(int64_t()), r2[i][4].as(int64_t()), r2[i][5].as(int64_t()), r2[i][6].as(int64_t()));
148+
#endif
147149
if (diff != 0) {
148150
if (delta == 0) {
149151
delta = diff;
150152
if (delta < 0) lt++; else gt++;
151-
} else if (delta != diff) {
153+
} else if ((delta ^ diff) < 0) {
152154
fflush(out);
153155
printf("Inconsistency found for record %d: [%d,%d]->[%ld,%ld] (snapshot %ld, last CSN %ld) vs. [%d,%d]->[%ld,%ld] (snapshot %ld, last CSN %ld)\n", i,
154156
r1[i][1].as(int()), r1[i][2].as(int()), r1[i][3].as(int64_t()), r1[i][4].as(int64_t()), r1[i][5].as(int64_t()), r1[i][6].as(int64_t()),

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