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