Skip to content

Commit 2fe7732

Browse files
knizhnikkelvich
authored andcommitted
Add multimaster.bypass variable to allow access to offline cluster node
1 parent 0f36ea2 commit 2fe7732

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

multimaster.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ static int MtmGcPeriod;
272272
static bool MtmIgnoreTablesWithoutPk;
273273
static int MtmLockCount;
274274
static bool MtmBreakConnection;
275+
static bool MtmBypass;
275276
static bool MtmClusterLocked;
276277
static bool MtmInsideTransaction;
277278
static bool MtmReferee;
@@ -960,7 +961,7 @@ MtmBeginTransaction(MtmCurrentTrans* x)
960961
x->isTwoPhase = false;
961962
x->isTransactionBlock = IsTransactionBlock();
962963
/* 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) {
964965
/* Reject all user's transactions at offline cluster.
965966
* Allow execution of transaction by bg-workers to make it possible to perform recovery.
966967
*/
@@ -979,7 +980,8 @@ MtmBeginTransaction(MtmCurrentTrans* x)
979980
*/
980981
if (x->isDistributed
981982
&& !MtmClusterLocked /* do not lock myself */
982-
&& strcmp(application_name, MULTIMASTER_ADMIN) != 0)
983+
&& strcmp(application_name, MULTIMASTER_ADMIN) != 0
984+
&& !MtmBypass)
983985
{
984986
MtmCheckClusterLock();
985987
}
@@ -2875,6 +2877,20 @@ _PG_init(void)
28752877
NULL,
28762878
NULL
28772879
);
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+
28782894
DefineCustomBoolVariable(
28792895
"multimaster.major_node",
28802896
"Node which forms a majority in case of partitioning in cliques with equal number of nodes",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy