@@ -270,6 +270,7 @@ static bool MtmIgnoreTablesWithoutPk;
270
270
static int MtmLockCount ;
271
271
static bool MtmMajorNode ;
272
272
static bool MtmBreakConnection ;
273
+ static bool MtmBypass ;
273
274
static bool MtmClusterLocked ;
274
275
static bool MtmInsideTransaction ;
275
276
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
}
@@ -3214,6 +3216,20 @@ _PG_init(void)
3214
3216
NULL ,
3215
3217
NULL
3216
3218
);
3219
+
3220
+ DefineCustomBoolVariable (
3221
+ "multimaster.bypass" ,
3222
+ "Allow access to offline multimaster node" ,
3223
+ NULL ,
3224
+ & MtmBypass ,
3225
+ false,
3226
+ PGC_USERSET , /* context */
3227
+ 0 ,
3228
+ NULL ,
3229
+ NULL ,
3230
+ NULL
3231
+ );
3232
+
3217
3233
DefineCustomBoolVariable (
3218
3234
"multimaster.major_node" ,
3219
3235
"Node which forms a majority in case of partitioning in cliques with equal number of nodes" ,
0 commit comments