Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ef499db

Browse files
knizhnikkelvich
authored andcommitted
Update ansible scripts to support dtmacid test
1 parent 9f7e131 commit ef499db

File tree

4 files changed

+73
-6
lines changed

4 files changed

+73
-6
lines changed

multimaster.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,6 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
425425
else
426426
{
427427
bool invisible = ts->status != TRANSACTION_STATUS_COMMITTED;
428-
if (invisible != PgXidInMVCCSnapshot(xid, snapshot)) {
429-
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);
430-
}
431428
MTM_LOG4("%d: tuple with xid=%d(csn= %ld) is %s in snapshot %ld",
432429
MyProcPid, xid, ts->csn, invisible ? "rollbacked" : "committed", MtmTx.snapshot);
433430
MtmUnlock();
@@ -458,7 +455,7 @@ MtmAdjustOldestXid(TransactionId xid)
458455
csn_t oldestSnapshot = INVALID_CSN;
459456
MtmTransState *prev = NULL;
460457
MtmTransState *ts = (MtmTransState*)hash_search(MtmXid2State, &xid, HASH_FIND, NULL);
461-
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);
458+
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);
462459
Mtm->gcCount = 0;
463460
if (ts != NULL) {
464461
oldestSnapshot = ts->snapshot;
@@ -491,7 +488,7 @@ MtmAdjustOldestXid(TransactionId xid)
491488
if (prev != NULL) {
492489
Mtm->transListHead = prev;
493490
Mtm->oldestXid = xid = prev->xid;
494-
MTM_LOG1("%d: MtmAdjustOldestXid: oldestXid=%d, olderstSnapshot=%ld", MyProcPid, xid, oldestSnapshot);
491+
MTM_LOG2("%d: MtmAdjustOldestXid: oldestXid=%d, olderstSnapshot=%ld", MyProcPid, xid, oldestSnapshot);
495492
} else if (TransactionIdPrecedes(Mtm->oldestXid, xid)) {
496493
xid = Mtm->oldestXid;
497494
}

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

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

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)