Skip to content

Commit e3ef202

Browse files
committed
add testing script
1 parent 2972a66 commit e3ef202

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

2pc.pgb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
\set aid random(1, 100000 * :scale)
2+
\set bid random(1, 1 * :scale)
3+
\set tid random(1, 10 * :scale)
4+
\set delta random(-5000, 5000)
5+
BEGIN;
6+
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
7+
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
8+
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
9+
PREPARE TRANSACTION 'xxxx0:client_id';
10+
COMMIT PREPARED 'xxxx0:client_id';

test.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
pkill -9 postgres
2+
rm -rf tmp_install
3+
make install
4+
5+
6+
7+
./tmp_install/bin/initdb -D ./tmp_install/data1
8+
echo 'local replication stas trust' >> ./tmp_install/data1/pg_hba.conf
9+
echo 'host replication all ::1/128 trust' >> ./tmp_install/data1/pg_hba.conf
10+
echo 'host all all ::1/128 trust' >> ./tmp_install/data1/pg_hba.conf
11+
echo 'host replication all 127.0.0.1/32 trust' >> ./tmp_install/data1/pg_hba.conf
12+
echo 'host all all 127.0.0.1/32 trust' >> ./tmp_install/data1/pg_hba.conf
13+
echo 'max_wal_senders = 10' >> ./tmp_install/data1/postgresql.conf
14+
echo 'wal_level = logical' >> ./tmp_install/data1/postgresql.conf
15+
echo 'max_prepared_transactions = 100' >> tmp_install/data1/postgresql.conf
16+
./tmp_install/bin/pg_ctl -w -D ./tmp_install/data1 -l logfile start
17+
createdb -h localhost
18+
pgbench -i -h localhost
19+
20+
21+
22+
23+
mkdir ./tmp_install/wals
24+
./tmp_install/bin/pg_receivexlog -D ./tmp_install/wals
25+
26+
27+
28+
pgbench -j 2 -c 10 -f 2pc.pgb -P 1 -r -t 300000
29+
30+
# pgbench -j 2 -c 10 -M prepared -P 1 -N -r -t 150000
31+
32+
33+
34+
35+
36+
37+
patched:
38+
-rw------- 1 stas staff 16M Feb 8 11:28 000000010000000000000064
39+
-rw------- 1 stas staff 16M Feb 8 11:28 000000010000000000000065.partial
40+
41+
# select pg_current_xlog_location();
42+
pg_current_xlog_location
43+
--------------------------
44+
0/65B68390
45+
46+
47+
patched-2pc.pgb (190b):
48+
-rw------- 1 stas staff 16M Feb 8 11:49 0000000100000000000000D7
49+
-rw------- 1 stas staff 16M Feb 8 11:50 0000000100000000000000D8.partial
50+
pg_current_xlog_location
51+
--------------------------
52+
0/D8B43E28
53+
54+
55+
56+
pgmaster (190b):
57+
-rw------- 1 stas staff 16M Feb 8 12:08 0000000100000000000000B6
58+
-rw------- 1 stas staff 16M Feb 8 12:08 0000000100000000000000B7.partial
59+
60+
pg_current_xlog_location
61+
--------------------------
62+
0/B7501578
63+
64+
pgmaster (6b):
65+
-rw------- 1 stas staff 16M Feb 8 12:33 000000010000000000000094
66+
-rw------- 1 stas staff 16M Feb 8 12:39 000000010000000000000095.partial
67+
68+
stas=# select pg_current_xlog_location();
69+
pg_current_xlog_location
70+
--------------------------
71+
0/9572CB28
72+
73+
patched-2pc.pgb (6b):
74+
-rw------- 1 stas staff 16M Feb 8 13:24 000000010000000000000095
75+
-rw------- 1 stas staff 16M Feb 8 13:30 000000010000000000000096.partial
76+
77+
78+
pg_current_xlog_location
79+
--------------------------
80+
0/96C442E0

0 commit comments

Comments
 (0)