File tree 3 files changed +22
-2
lines changed 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ int MtmHeartbeatSendTimeout;
208
208
int MtmHeartbeatRecvTimeout ;
209
209
bool MtmUseRaftable ;
210
210
bool MtmUseDtm ;
211
+ bool MtmPreserveCommitOrder ;
211
212
bool MtmVolksWagenMode ;
212
213
213
214
TransactionId MtmUtilityProcessedInXid ;
@@ -2342,6 +2343,19 @@ _PG_init(void)
2342
2343
NULL
2343
2344
);
2344
2345
2346
+ DefineCustomBoolVariable (
2347
+ "multimaster.preserve_commit_order" ,
2348
+ "Transactions from one node will be committed in same order al all nodes" ,
2349
+ NULL ,
2350
+ & MtmPreserveCommitOrder ,
2351
+ true,
2352
+ PGC_BACKEND ,
2353
+ 0 ,
2354
+ NULL ,
2355
+ NULL ,
2356
+ NULL
2357
+ );
2358
+
2345
2359
DefineCustomBoolVariable (
2346
2360
"multimaster.volkswagen_mode" ,
2347
2361
"Pretend to be normal postgres. This means skip some NOTICE's and use local sequences. Default false." ,
Original file line number Diff line number Diff line change 58
58
#define MB (1024*1024L)
59
59
60
60
#define USEC_TO_MSEC (t ) ((t)/1000)
61
- #define MSEC_TO_USEC (t ) ((t)*1000)
61
+ #define MSEC_TO_USEC (t ) ((timestamp_t)( t)*1000)
62
62
63
63
#define Natts_mtm_ddl_log 2
64
64
#define Anum_mtm_ddl_log_issued 1
@@ -287,6 +287,7 @@ extern int MtmTransSpillThreshold;
287
287
extern int MtmHeartbeatSendTimeout ;
288
288
extern int MtmHeartbeatRecvTimeout ;
289
289
extern bool MtmUseDtm ;
290
+ extern bool MtmPreserveCommitOrder ;
290
291
extern HTAB * MtmXid2State ;
291
292
extern HTAB * MtmGid2State ;
292
293
Original file line number Diff line number Diff line change @@ -527,7 +527,12 @@ pglogical_receiver_main(Datum main_arg)
527
527
spill_file = -1 ;
528
528
resetStringInfo (& spill_info );
529
529
} else {
530
- MtmExecute (buf .data , buf .used );
530
+ if (MtmPreserveCommitOrder && buf .used == rc - hdr_len ) {
531
+ /* Perform commit-prepared and rollback-prepared requested directly in receiver */
532
+ MtmExecutor (nodeId , buf .data , buf .used );
533
+ } else {
534
+ MtmExecute (buf .data , buf .used );
535
+ }
531
536
}
532
537
ByteBufferReset (& buf );
533
538
}
You can’t perform that action at this time.
0 commit comments