@@ -272,6 +272,7 @@ static int MtmGcPeriod;
272
272
static bool MtmIgnoreTablesWithoutPk ;
273
273
static int MtmLockCount ;
274
274
static bool MtmBreakConnection ;
275
+ static bool MtmBypass ;
275
276
static bool MtmClusterLocked ;
276
277
static bool MtmInsideTransaction ;
277
278
static bool MtmReferee ;
@@ -960,7 +961,7 @@ MtmBeginTransaction(MtmCurrentTrans* x)
960
961
x -> isTwoPhase = false;
961
962
x -> isTransactionBlock = IsTransactionBlock ();
962
963
/* Application name can be changed using PGAPPNAME environment variable */
963
- if (x -> isDistributed && Mtm -> status != MTM_ONLINE && strcmp (application_name , MULTIMASTER_ADMIN ) != 0 ) {
964
+ if (x -> isDistributed && Mtm -> status != MTM_ONLINE && strcmp (application_name , MULTIMASTER_ADMIN ) != 0 && ! MtmBypass ) {
964
965
/* Reject all user's transactions at offline cluster.
965
966
* Allow execution of transaction by bg-workers to make it possible to perform recovery.
966
967
*/
@@ -979,7 +980,8 @@ MtmBeginTransaction(MtmCurrentTrans* x)
979
980
*/
980
981
if (x -> isDistributed
981
982
&& !MtmClusterLocked /* do not lock myself */
982
- && strcmp (application_name , MULTIMASTER_ADMIN ) != 0 )
983
+ && strcmp (application_name , MULTIMASTER_ADMIN ) != 0
984
+ && !MtmBypass )
983
985
{
984
986
MtmCheckClusterLock ();
985
987
}
@@ -2875,6 +2877,20 @@ _PG_init(void)
2875
2877
NULL ,
2876
2878
NULL
2877
2879
);
2880
+
2881
+ DefineCustomBoolVariable (
2882
+ "multimaster.bypass" ,
2883
+ "Allow access to offline multimaster node" ,
2884
+ NULL ,
2885
+ & MtmBypass ,
2886
+ false,
2887
+ PGC_USERSET , /* context */
2888
+ 0 ,
2889
+ NULL ,
2890
+ NULL ,
2891
+ NULL
2892
+ );
2893
+
2878
2894
DefineCustomBoolVariable (
2879
2895
"multimaster.major_node" ,
2880
2896
"Node which forms a majority in case of partitioning in cliques with equal number of nodes" ,
0 commit comments