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

Commit4574fbd

Browse files
knizhnikkelvich
authored andcommitted
Keep data for disabled nodes
1 parent991a5e2 commit4574fbd

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

‎arbiter.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,14 @@ static void MtmAcceptOneConnection()
361361
close(fd);
362362
}else{
363363
Assert(msg.node>0&&msg.node <=MtmNodes&&msg.node!=MtmNodeId);
364-
elog(NOTICE,"Arbiter established connection with node %d",msg.node);
365-
MtmRegisterSocket(fd,msg.node-1);
366-
sockets[msg.node-1]=fd;
364+
if (BIT_SET(ds->disabledNodeMask,msg.node-1)) {
365+
elog(WARNING,"Reject attempt to reconnect from disabled node %d",msg.node);
366+
close(fd);
367+
}else {
368+
elog(NOTICE,"Arbiter established connection with node %d",msg.node);
369+
MtmRegisterSocket(fd,msg.node-1);
370+
sockets[msg.node-1]=fd;
371+
}
367372
}
368373
}
369374
}

‎multimaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ void MtmDropNode(int nodeId, bool dropSlot)
902902
}
903903
if (dropSlot)
904904
{
905-
ReplicationSlotDrop(psprintf("mtm_slot_%d",nodeId));
905+
ReplicationSlotDrop(psprintf(MULTIMASTER_SLOT_PATTERN,nodeId));
906906
}
907907
}
908908
}

‎multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#defineMULTIMASTER_NAME "mtm"
1818
#defineMULTIMASTER_SCHEMA_NAME "mtm"
1919
#defineMULTIMASTER_DDL_TABLE "ddl_log"
20+
#defineMULTIMASTER_SLOT_PATTERN "mtm_slot_%d"
2021

2122
#defineNatts_mtm_ddl_log 2
2223
#defineAnum_mtm_ddl_log_issued1

‎pglogical_proto.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
typedefstructPGLogicalProtoMM
4040
{
4141
PGLogicalProtoAPIapi;
42+
MtmState*state;
43+
intnodeId;
4244
boolisLocal;
4345
}PGLogicalProtoMM;
4446

@@ -106,7 +108,7 @@ pglogical_write_begin(StringInfo out, PGLogicalOutputData *data,
106108
PGLogicalProtoMM*mm= (PGLogicalProtoMM*)data->api;
107109
csn_tcsn=MtmTransactionSnapshot(txn->xid);
108110
MTM_TRACE("pglogical_write_begin %d CSN=%ld\n",txn->xid,csn);
109-
if (csn==INVALID_CSN) {
111+
if (csn==INVALID_CSN||BIT_SET(mm->state->disabledNodeMask,mm->nodeId-1)) {
110112
mm->isLocal= true;
111113
}else {
112114
mm->isLocal= false;
@@ -377,6 +379,8 @@ pglogical_init_api(PGLogicalProtoType typ)
377379
PGLogicalProtoMM*pmm=palloc0(sizeof(PGLogicalProtoMM));
378380
PGLogicalProtoAPI*res=&pmm->api;
379381
pmm->isLocal= false;
382+
pmm->state=MtmGetState();
383+
sscanf(MyReplicationSlot->data.name.data,MULTIMASTER_SLOT_PATTERN,&pmm->nodeId);
380384
res->write_rel=pglogical_write_rel;
381385
res->write_begin=pglogical_write_begin;
382386
res->write_commit=pglogical_write_commit;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp