Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d6a93e

Browse files
knizhnikkelvich
authored andcommitted
Make it possible to switch off DTM
1 parent0e79f78 commit4d6a93e

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

‎multimaster.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ int MtmKeepaliveTimeout;
181181
intMtmReconnectAttempts;
182182
intMtmNodeDisableDelay;
183183
boolMtmUseRaftable;
184+
boolMtmUseDtm;
184185
MtmConnectionInfo*MtmConnections;
185186

186187
staticchar*MtmConnStrs;
@@ -339,7 +340,7 @@ TransactionId MtmGetOldestXmin(Relation rel, bool ignoreVacuum)
339340
}
340341

341342
boolMtmXidInMVCCSnapshot(TransactionIdxid,Snapshotsnapshot)
342-
{
343+
{
343344
#ifTRACE_SLEEP_TIME
344345
statictimestamp_tfirstReportTime;
345346
statictimestamp_tprevReportTime;
@@ -349,6 +350,10 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
349350
timestamp_tdelay=MIN_WAIT_TIMEOUT;
350351
Assert(xid!=InvalidTransactionId);
351352

353+
if (!MtmUseDtm) {
354+
returnPgXidInMVCCSnapshot(xid,snapshot);
355+
}
356+
352357
MtmLock(LW_SHARED);
353358

354359
#ifTRACE_SLEEP_TIME
@@ -768,7 +773,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
768773
tm->state=ts;
769774
ts->votingCompleted= true;
770775
if (Mtm->status!=MTM_RECOVERY) {
771-
MtmSendNotificationMessage(ts,MSG_READY);/* send notification to coordinator */
776+
MtmSendNotificationMessage(ts,MtmUseDtm ?MSG_READY :MSG_PREPARED);/* send notification to coordinator */
772777
}else {
773778
ts->status=TRANSACTION_STATUS_UNKNOWN;
774779
}
@@ -1651,6 +1656,19 @@ _PG_init(void)
16511656
NULL
16521657
);
16531658

1659+
DefineCustomBoolVariable(
1660+
"multimaster.use_dtm",
1661+
"Use distributed transaction manager",
1662+
NULL,
1663+
&MtmUseDtm,
1664+
true,
1665+
PGC_BACKEND,
1666+
0,
1667+
NULL,
1668+
NULL,
1669+
NULL
1670+
);
1671+
16541672
DefineCustomIntVariable(
16551673
"multimaster.workers",
16561674
"Number of multimaster executor workers per node",

‎multimaster.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include"pglogical_output/hooks.h"
99

10-
#defineDEBUG_LEVEL1
10+
#defineDEBUG_LEVEL0
1111

1212
#ifDEBUG_LEVEL==0
1313
#defineMTM_LOG1(fmt, ...) elog(LOG, fmt, ## __VA_ARGS__)
@@ -191,6 +191,7 @@ extern int MtmConnectTimeout;
191191
externintMtmReconnectAttempts;
192192
externintMtmKeepaliveTimeout;
193193
externintMtmNodeDisableDelay;
194+
externboolMtmUseDtm;
194195
externHTAB*MtmXid2State;
195196

196197
externMtmConnectionInfo*MtmConnections;

‎tests/deploy_layouts/cluster.yml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
---
22

3-
-hosts:nodes[0]
4-
5-
roles:
6-
-role:postgres
7-
pg_port:15432
8-
pg_repo:https://github.com/postgrespro/postgres_cluster.git
9-
pg_version_tag:master
10-
pg_destroy_and_init:true
11-
12-
tasks:
13-
-name:build sockhub
14-
shell:"make clean && make -j 4"
15-
args:
16-
chdir:"~/pg_cluster/src/contrib/arbiter/sockhub"
17-
18-
-name:build dtm
19-
shell:"make clean && make -j 4"
20-
args:
21-
chdir:"~/pg_cluster/src/contrib/arbiter"
22-
# when: dtm_sources.changed
23-
24-
-name:kill arbiter
25-
shell:kill -9 `cat ~/pg_cluster/dtm_data/arbiter.pid` || true
26-
27-
-name:ensure datadir for dtm exists
28-
shell:"rm -rf ~/pg_cluster/dtm_data && mkdir ~/pg_cluster/dtm_data"
29-
30-
-name:start dtm
31-
shell:>
32-
nohup ~/pg_cluster/src/contrib/arbiter/bin/arbiter
33-
-d ~/pg_cluster/dtm_data -r 0.0.0.0:5431 -i 0 -l ~/pg_cluster/dtm_data/log &
34-
35-
-name:wait until dtm is available
36-
wait_for:port=5431 delay=1
37-
38-
393
-hosts:nodes[1]:nodes[2]:nodes[3]
404
# accelerate: true
415

@@ -61,10 +25,10 @@
6125
set_fact:
6226
connections:"{{ connstrs.results | map(attribute='ansible_facts.connstr') | join(', ') }}"
6327

64-
-name:buildsockhub
65-
shell:"make clean && make -j4"
28+
-name:buildraftable
29+
shell:"make clean && make -j{{makejobs}} install"
6630
args:
67-
chdir:"{{pg_src}}/contrib/arbiter/sockhub"
31+
chdir:"{{pg_src}}/contrib/raftable"
6832

6933
-name:build multimaster
7034
shell:"make clean && make -j {{makejobs}} install"
@@ -81,13 +45,17 @@
8145
-"max_wal_senders = 10"
8246
-"wal_sender_timeout = 0"
8347
-"max_replication_slots = 10"
48+
-"max_connections = 200"
8449
-"max_worker_processes = 100"
85-
-"shared_preload_libraries = 'multimaster'"
86-
-"multimaster.arbiters = '{{groups['nodes'][0]}}:5431'"
50+
-"shared_preload_libraries = 'raftable,multimaster'"
8751
-"multimaster.conn_strings = '{{connections}}'"
8852
-"multimaster.node_id = {{ node_id }}"
53+
-"multimaster.buffer_size = 65536"
8954
-"multimaster.queue_size = 1073741824"
55+
-"multimaster.arbiter_port = 5600"
56+
-"multimaster.vacuum_delay = 1"
9057
-"multimaster.workers = 32"
58+
-"multimaster.use_dtm = 0"
9159

9260
-name:restart postgrespro
9361
command:"{{pg_dst}}/bin/pg_ctl restart -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"

‎tests/perf.results

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,16 @@ Bench finished at Пн. февр. 15 18:37:50 MSK 2016
138138
Bench started at Пн. февр. 15 18:44:02 MSK 2016
139139
astro5:{tps:121774.204222, transactions:100000000, selects:200000000, updates:0, aborts:0, abort_percent: 0, readers:0, writers:200, update_percent:0, accounts:500000, iterations:500000, hosts:3}
140140
Bench finished at Пн. февр. 15 18:57:44 MSK 2016
141+
Bench started at Ср. апр. 13 13:52:07 MSK 2016
142+
143+
Bench finished at Ср. апр. 13 13:52:07 MSK 2016
144+
Bench started at Ср. апр. 13 13:52:45 MSK 2016
145+
Bench started at Ср. апр. 13 14:03:54 MSK 2016
146+
astro5:{tps:115156.025890, transactions:50000000, selects:100000000, updates:0, aborts:0, abort_percent: 0, readers:0, writers:100, update_percent:0, accounts:500000, iterations:500000, hosts:3}
147+
Bench finished at Ср. апр. 13 14:11:09 MSK 2016
148+
Bench started at Ср. апр. 13 14:13:55 MSK 2016
149+
astro5:{tps:16576.973635, transactions:1000000, selects:0, updates:2000758, aborts:820, abort_percent: 0, readers:0, writers:100, update_percent:100, accounts:500000, iterations:10000, hosts:3}
150+
Bench finished at Ср. апр. 13 14:14:56 MSK 2016
151+
Bench started at Ср. апр. 13 14:23:33 MSK 2016
152+
astro5:{tps:16078.719352, transactions:1000000, selects:0, updates:2000802, aborts:788, abort_percent: 0, readers:0, writers:100, update_percent:100, accounts:500000, iterations:10000, hosts:3}
153+
Bench finished at Ср. апр. 13 14:24:36 MSK 2016

‎tests/perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
-name:run transfers
4747
shell:>
4848
~/pg_cluster/install/bin/dtmbench {{connections}}
49-
-w {{ nconns }} -r 0 -n500000 -a 500000 -p {{ up }} |
49+
-w {{ nconns }} -r 0 -n10000 -a 500000 -p {{ up }} |
5050
tee -a perf.results |
5151
sed "s/^/`hostname`:/"
5252
register:transfers_result

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp