@@ -663,6 +663,15 @@ MtmResetTransaction(MtmCurrentTrans* x)
663
663
x -> status = TRANSACTION_STATUS_UNKNOWN ;
664
664
}
665
665
666
+
667
+ static const char * const isoLevelStr [] =
668
+ {
669
+ "read uncommitted" ,
670
+ "read committed" ,
671
+ "repeatable read" ,
672
+ "serializable"
673
+ };
674
+
666
675
static void
667
676
MtmBeginTransaction (MtmCurrentTrans * x )
668
677
{
@@ -679,13 +688,16 @@ MtmBeginTransaction(MtmCurrentTrans* x)
679
688
x -> isPrepared = false;
680
689
x -> isTransactionBlock = IsTransactionBlock ();
681
690
/* Application name can be changed usnig PGAPPNAME environment variable */
682
- if (! IsBackgroundWorker && x -> isDistributed && Mtm -> status != MTM_ONLINE && strcmp (application_name , MULTIMASTER_ADMIN ) != 0 ) {
691
+ if (x -> isDistributed && Mtm -> status != MTM_ONLINE && strcmp (application_name , MULTIMASTER_ADMIN ) != 0 ) {
683
692
/* Reject all user's transactions at offline cluster.
684
693
* Allow execution of transaction by bg-workers to make it possible to perform recovery.
685
694
*/
686
695
MtmUnlock ();
687
696
elog (ERROR , "Multimaster node is not online: current status %s" , MtmNodeStatusMnem [Mtm -> status ]);
688
697
}
698
+ if (x -> isDistributed && XactIsoLevel != XACT_REPEATABLE_READ ) {
699
+ elog (LOG , "Isolation level %s is not supported by multimaster" , isoLevelStr [XactIsoLevel ]);
700
+ }
689
701
x -> containsDML = false;
690
702
x -> snapshot = MtmAssignCSN ();
691
703
x -> gtid .xid = InvalidTransactionId ;
@@ -2163,6 +2175,13 @@ _PG_init(void)
2163
2175
NULL
2164
2176
);
2165
2177
2178
+ if (DefaultXactIsoLevel != XACT_REPEATABLE_READ ) {
2179
+ elog (ERROR , "Multimaster requires repeatable read default isolation level" );
2180
+ }
2181
+ if (synchronous_commit != SYNCHRONOUS_COMMIT_ON ) {
2182
+ elog (ERROR , "Multimaster requires synchronous commit on" );
2183
+ }
2184
+
2166
2185
MtmSplitConnStrs ();
2167
2186
MtmStartReceivers ();
2168
2187
0 commit comments