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

Commit2761da1

Browse files
knizhnikkelvich
authored andcommitted
Preserve commit order
1 parentdb0930a commit2761da1

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

‎multimaster.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ int MtmHeartbeatSendTimeout;
207207
intMtmHeartbeatRecvTimeout;
208208
boolMtmUseRaftable;
209209
boolMtmUseDtm;
210+
boolMtmPreserveCommitOrder;
210211
boolMtmVolksWagenMode;
211212

212213
TransactionIdMtmUtilityProcessedInXid;
@@ -2341,6 +2342,19 @@ _PG_init(void)
23412342
NULL
23422343
);
23432344

2345+
DefineCustomBoolVariable(
2346+
"multimaster.preserve_commit_order",
2347+
"Transactions from one node will be committed in same order al all nodes",
2348+
NULL,
2349+
&MtmPreserveCommitOrder,
2350+
true,
2351+
PGC_BACKEND,
2352+
0,
2353+
NULL,
2354+
NULL,
2355+
NULL
2356+
);
2357+
23442358
DefineCustomBoolVariable(
23452359
"multimaster.volkswagen_mode",
23462360
"Pretend to be normal postgres. This means skip some NOTICE's and use local sequences. Default false.",

‎multimaster.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#defineMB (1024*1024L)
5959

6060
#defineUSEC_TO_MSEC(t) ((t)/1000)
61-
#defineMSEC_TO_USEC(t) ((t)*1000)
61+
#defineMSEC_TO_USEC(t) ((timestamp_t)(t)*1000)
6262

6363
#defineNatts_mtm_ddl_log 2
6464
#defineAnum_mtm_ddl_log_issued1
@@ -287,6 +287,7 @@ extern int MtmTransSpillThreshold;
287287
externintMtmHeartbeatSendTimeout;
288288
externintMtmHeartbeatRecvTimeout;
289289
externboolMtmUseDtm;
290+
externboolMtmPreserveCommitOrder;
290291
externHTAB*MtmXid2State;
291292
externHTAB*MtmGid2State;
292293

‎pglogical_receiver.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,12 @@ pglogical_receiver_main(Datum main_arg)
528528
spill_file=-1;
529529
resetStringInfo(&spill_info);
530530
}else {
531-
MtmExecute(buf.data,buf.used);
531+
if (MtmPreserveCommitOrder&&buf.used==rc-hdr_len) {
532+
/* Perform commit-prepared and rollback-prepared requested directly in receiver */
533+
MtmExecutor(nodeId,buf.data,buf.used);
534+
}else {
535+
MtmExecute(buf.data,buf.used);
536+
}
532537
}
533538
ByteBufferReset(&buf);
534539
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp