Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f077cf

Browse files
committed
Add multimaster.bypass variable to allow access to offline cluster node
1 parentca6bec3 commit7f077cf

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

‎contrib/mmts/multimaster.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static bool MtmIgnoreTablesWithoutPk;
270270
staticintMtmLockCount;
271271
staticboolMtmMajorNode;
272272
staticboolMtmBreakConnection;
273+
staticboolMtmBypass;
273274
staticboolMtmClusterLocked;
274275
staticboolMtmInsideTransaction;
275276
staticboolMtmReferee;
@@ -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
}
@@ -3214,6 +3216,20 @@ _PG_init(void)
32143216
NULL,
32153217
NULL
32163218
);
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+
32173233
DefineCustomBoolVariable(
32183234
"multimaster.major_node",
32193235
"Node which forms a majority in case of partitioning in cliques with equal number of nodes",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp