@@ -663,6 +663,15 @@ MtmResetTransaction(MtmCurrentTrans* x)
663663 x -> status = TRANSACTION_STATUS_UNKNOWN ;
664664}
665665
666+
667+ static const char * const isoLevelStr [] =
668+ {
669+ "read uncommitted" ,
670+ "read committed" ,
671+ "repeatable read" ,
672+ "serializable"
673+ };
674+
666675static void
667676MtmBeginTransaction (MtmCurrentTrans * x )
668677{
@@ -679,13 +688,16 @@ MtmBeginTransaction(MtmCurrentTrans* x)
679688 x -> isPrepared = false;
680689 x -> isTransactionBlock = IsTransactionBlock ();
681690 /* 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 ) {
683692 /* Reject all user's transactions at offline cluster.
684693 * Allow execution of transaction by bg-workers to make it possible to perform recovery.
685694 */
686695 MtmUnlock ();
687696 elog (ERROR , "Multimaster node is not online: current status %s" , MtmNodeStatusMnem [Mtm -> status ]);
688697 }
698+ if (x -> isDistributed && XactIsoLevel != XACT_REPEATABLE_READ ) {
699+ elog (LOG , "Isolation level %s is not supported by multimaster" , isoLevelStr [XactIsoLevel ]);
700+ }
689701 x -> containsDML = false;
690702 x -> snapshot = MtmAssignCSN ();
691703 x -> gtid .xid = InvalidTransactionId ;
@@ -2163,6 +2175,13 @@ _PG_init(void)
21632175 NULL
21642176 );
21652177
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+
21662185 MtmSplitConnStrs ();
21672186 MtmStartReceivers ();
21682187
0 commit comments