Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2225c9

Browse files
knizhnikkelvich
authored andcommitted
Cleanup disconnected bit for recovered node
1 parent 0bec1d3 commit b2225c9

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

multimaster.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,9 @@ void MtmSendNotificationMessage(MtmTransState* ts, MtmMessageCode cmd)
842842

843843
void MtmRecoveryCompleted(void)
844844
{
845-
elog(WARNING, "Recevoery of node %d is completed", MtmNodeId);
845+
elog(WARNING, "Recovery of node %d is completed", MtmNodeId);
846846
Mtm->recoverySlot = 0;
847+
BIT_CLEAR(Mtm->disabledNodeMask, MtmNodeId-1);
847848
MtmSwitchClusterMode(MTM_ONLINE);
848849
}
849850

@@ -1745,10 +1746,6 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
17451746
break;
17461747
}
17471748
}
1748-
if (isRecoverySession) {
1749-
MTM_INFO("%d: PGLOGICAL startup hook\n", MyProcPid);
1750-
sleep(30);
1751-
}
17521749
MtmLock(LW_EXCLUSIVE);
17531750
if (isRecoverySession) {
17541751
elog(WARNING, "Node %d start recovery of node %d", MtmNodeId, MtmReplicationNodeId);

pglogical_receiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static volatile sig_atomic_t got_sighup = false;
5353

5454
/* GUC variables */
5555
static int receiver_idle_time = 0;
56-
static bool receiver_sync_mode = false;
56+
static bool receiver_sync_mode = true;
5757

5858
/* Worker name */
5959
char worker_proc[BGW_MAXLEN];
@@ -292,7 +292,7 @@ pglogical_receiver_main(Datum main_arg)
292292
}
293293
CommitTransactionCommand();
294294

295-
appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %u/%u (\"startup_params_format\" '1', \"max_proto_version\" '%d', \"min_proto_version\" '%d', \"mtm_replication_mode\" '%s')",
295+
appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %u/%u (\"startup_params_format\" '1', \"max_proto_version\" '%d', \"min_proto_version\" '%d', \"forward_changesets\" '1', \"mtm_replication_mode\" '%s')",
296296
args->receiver_slot,
297297
(uint32) (originStartPos >> 32),
298298
(uint32) originStartPos,

raftable.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <dlfcn.h>
2+
#include "postgres.h"
3+
#include "raftable.h"
4+
5+
6+
static raftable_get_t raftable_get_impl;
7+
static raftable_set_t raftable_set_impl;
8+
9+
static void RaftableResolve()
10+
{
11+
if (raftable_get_impl == NULL) {
12+
void* dll = dlopen(NULL, RTLD_NOW);
13+
raftable_get_impl = dlsym(dll, "raftable_get");
14+
raftable_set_impl = dlsym(dll, "raftable_set");
15+
Assert(raftable_get_impl != NULL && raftable_set_impl != NULL);
16+
}
17+
}
18+
19+
/*
20+
* Raftable function proxies
21+
*/
22+
void* RaftableGet(char const* key, int* size, RaftableTimestamp* ts, bool nowait)
23+
{
24+
if (!MtmUseRaftable) {
25+
return NULL;
26+
}
27+
RaftableResolve();
28+
return (*raftable_get_impl)(key, size, nowait ? 0 : -1);
29+
}
30+
31+
32+
void RaftableSet(char const* key, void const* value, int size, bool nowait)
33+
{
34+
if (MtmUseRaftable) {
35+
RaftableResolve();
36+
(*raftable_set_impl)(key, value, size, nowait ? 0 : -1);
37+
}
38+
}

0 commit comments

Comments
 (0)