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

Commitc1790a6

Browse files
knizhnikkelvich
authored andcommitted
Support adding new node
1 parentc17006f commitc1790a6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

‎multimaster--1.0.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ CREATE FUNCTION mtm.drop_node(node integer, drop_slot bool default false) RETURN
1313
AS'MODULE_PATHNAME','mtm_drop_node'
1414
LANGUAGE C;
1515

16-
-- -- XXX: cstring as an argument breaks sanity check
17-
-- CREATE FUNCTION mtm.add_node(conn_str cstring) RETURNS void
18-
-- AS 'MODULE_PATHNAME','mtm_add_node'
19-
-- LANGUAGE C;
16+
CREATEFUNCTIONmtm.add_node(conn_str cstring) RETURNS void
17+
AS'MODULE_PATHNAME','mtm_add_node'
18+
LANGUAGE C;
2019

2120
-- Create replication slot for the node which was previously dropped together with it's slot
2221
CREATEFUNCTIONmtm.recover_node(nodeinteger) RETURNS void

‎multimaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ static void MtmCheckControlFile(void)
19321932
if (f==NULL) {
19331933
elog(FATAL,"Failed to create mmts_control file: %m");
19341934
}
1935-
Mtm->donorNodeId=-1;
1935+
Mtm->donorNodeId=MtmNodeId;
19361936
fprintf(f,"%s:%d\n",MtmClusterName,Mtm->donorNodeId);
19371937
fclose(f);
19381938
}
@@ -2706,7 +2706,7 @@ MtmReplicationMode MtmGetReplicationMode(int nodeId, sig_atomic_t volatile* shut
27062706
MtmLock(LW_EXCLUSIVE);
27072707
if (Mtm->status==MTM_RECOVERY) {
27082708
recovery= true;
2709-
if ((Mtm->recoverySlot==0&& (Mtm->donorNodeId<0||Mtm->donorNodeId==nodeId))
2709+
if ((Mtm->recoverySlot==0&& (Mtm->donorNodeId==MtmNodeId||Mtm->donorNodeId==nodeId))
27102710
||Mtm->recoverySlot==nodeId)
27112711
{
27122712
/* Choose for recovery first available slot or slot of donor node (if any) */
@@ -2819,7 +2819,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
28192819
}
28202820
}elseif (strcmp("mtm_restart_pos",elem->defname)==0) {
28212821
if (elem->arg!=NULL&&strVal(elem->arg)!=NULL) {
2822-
recoveryStartPos=intVal(elem->arg);
2822+
sscanf(strVal(elem->arg),"%lx",&recoveryStartPos);
28232823
}else {
28242824
elog(ERROR,"Restart position is not specified");
28252825
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp