Skip to content

Commit c530486

Browse files
committed
Fix restart of raftable
1 parent 773a9e1 commit c530486

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

contrib/mmts/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ USER postgres
3131
ENV CFLAGS -O0
3232
WORKDIR /pg
3333

34-
ENV REBUILD 4
34+
ENV REBUILD 5
3535

3636
RUN cd /pg && \
3737
git clone https://github.com/postgrespro/postgres_cluster.git --depth 1 && \

contrib/mmts/arbiter.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static BackgroundWorker MtmRecevier = {
144144

145145
void MtmArbiterInitialize(void)
146146
{
147+
elog(LOG, "Register background workers");
147148
RegisterBackgroundWorker(&MtmSender);
148149
RegisterBackgroundWorker(&MtmRecevier);
149150
}
@@ -659,7 +660,7 @@ static void MtmTransSender(Datum arg)
659660
int i;
660661

661662
MtmBuffer* txBuffer = (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
662-
663+
elog(LOG, "Start arbiter sender %d", MyProcPid);
663664
InitializeTimeouts();
664665

665666
signal(SIGINT, SetStop);

contrib/mmts/tests2/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if [ "$1" = 'postgres' ]; then
6969
max_prepared_transactions = 100
7070
synchronous_commit = off
7171
wal_level = logical
72-
max_worker_processes = 15
72+
max_worker_processes = 30
7373
max_replication_slots = 10
7474
max_wal_senders = 10
7575
shared_preload_libraries = 'raftable,multimaster'

contrib/raftable/raftable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static WorkerConfig wcfg;
5252
static char *peerstr;
5353
static shmem_startup_hook_type PreviousShmemStartupHook;
5454

55-
static void *get_shared_state(void)
55+
StateP get_shared_state(void)
5656
{
5757
return shared.state;
5858
}
@@ -543,7 +543,7 @@ static void startup_shmem(void)
543543
bool found;
544544

545545
if (PreviousShmemStartupHook) PreviousShmemStartupHook();
546-
546+
elog(LOG, "Raftable initialize shared state %d", MyProcPid);
547547
shared.state = state_shmem_init();
548548
shared.leader = ShmemInitStruct("raftable_leader", sizeof(int), &found);
549549
*shared.leader = NOBODY;

contrib/raftable/state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ bool state_next(StateP state, void *scan, char **key, char **value, size_t *len)
4141
void state_shmem_request(void);
4242
StateP state_shmem_init(void);
4343

44+
StateP get_shared_state(void);
45+
4446
#endif

contrib/raftable/worker.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,12 @@ static void worker_main(Datum arg)
441441
sigset_t sset;
442442
mstimer_t t;
443443
WorkerConfig *cfg = (WorkerConfig *)(arg);
444-
StateP state = (StateP)cfg->getter();
444+
StateP state;
445445

446446
fprintf(stderr, "raftable worker_main(): stop = %d\n", stop);
447447

448+
state = (StateP)get_shared_state();
449+
448450
cfg->raft_config.userdata = state;
449451
cfg->raft_config.applier = applier;
450452
cfg->raft_config.snapshooter = snapshooter;

contrib/raftable/worker.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ typedef struct HostPort {
1717
int port;
1818
} HostPort;
1919

20-
typedef void *(*StateGetter)(void);
20+
struct State;
21+
22+
typedef struct State* (*StateGetter)(void);
2123

2224
typedef struct WorkerConfig {
2325
int id;

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