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 @@ -207,6 +207,7 @@ int MtmHeartbeatSendTimeout;
207
207
int MtmHeartbeatRecvTimeout ;
208
208
bool MtmUseRaftable ;
209
209
bool MtmUseDtm ;
210
+ bool MtmPreserveCommitOrder ;
210
211
bool MtmVolksWagenMode ;
211
212
212
213
TransactionId MtmUtilityProcessedInXid ;
@@ -2341,6 +2342,19 @@ _PG_init(void)
2341
2342
NULL
2342
2343
);
2343
2344
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
+
2344
2358
DefineCustomBoolVariable (
2345
2359
"multimaster.volkswagen_mode" ,
2346
2360
"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 @@ -528,7 +528,12 @@ pglogical_receiver_main(Datum main_arg)
528
528
spill_file = -1 ;
529
529
resetStringInfo (& spill_info );
530
530
} 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
+ }
532
537
}
533
538
ByteBufferReset (& buf );
534
539
}
You can’t perform that action at this time.
0 commit comments