BUG/MEDIUM: peers: Wait for sync task ack when a resynchro is finished

When a learning process is finished, partially or not, the event must be
processed by the sync task. It is important for the peer applet to wait in
this case, especially if the same peer is teaching to another peer, to be
sure to send the right resync finished message (full or partial).

Thanks to the previous patch, we can set PEER_F_WAIT_SYNCTASK_ACK flag on
the peer when a PEER_MSG_CTRL_RESYNCPARTIAL or PEER_MSG_CTRL_RESYNCFINISHED
message is received to be sure to stop the processing. Of course, we must
also take care to wake the peer up after having acknowledged the learn
status from the sync task.

This patch depends on the commit "BUG/MEDIUM: peers: Wait for sync task ack
when a resynchro is finished". Both must be backported if commit 9425aeaffb
("BUG/MAJOR: peers: Update peers section state from a thread-safe manner")
is backported.
This commit is contained in:
Christopher Faulet 2024-04-24 10:53:46 +02:00
parent 12014587fa
commit e35293b2d3

View File

@ -2510,7 +2510,7 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
NULL, &msg_head[1], peers->local->id, peer->id);
if (peer->flags & PEER_F_LEARN_PROCESS) {
peer->flags &= ~PEER_F_LEARN_PROCESS;
peer->flags |= PEER_F_LEARN_FINISHED;
peer->flags |= (PEER_F_LEARN_FINISHED|PEER_F_WAIT_SYNCTASK_ACK);
task_wakeup(peers->sync_task, TASK_WOKEN_MSG);
}
peer->confirm++;
@ -2520,7 +2520,7 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
NULL, &msg_head[1], peers->local->id, peer->id);
if (peer->flags & PEER_F_LEARN_PROCESS) {
peer->flags &= ~PEER_F_LEARN_PROCESS;
peer->flags |= (PEER_F_LEARN_FINISHED|PEER_F_LEARN_NOTUP2DATE);
peer->flags |= (PEER_F_LEARN_FINISHED|PEER_F_LEARN_NOTUP2DATE|PEER_F_WAIT_SYNCTASK_ACK);
task_wakeup(peers->sync_task, TASK_WOKEN_MSG);
}
peer->confirm++;
@ -3393,6 +3393,8 @@ static void __process_peer_learn_status(struct peers *peers, struct peer *peer)
}
peer->flags &= ~(PEER_F_LEARN_ASSIGN|PEER_F_LEARN_PROCESS|PEER_F_LEARN_FINISHED);
peers->flags &= ~(PEERS_F_RESYNC_ASSIGN|PEERS_F_RESYNC_PROCESS);
appctx_wakeup(peer->appctx);
}
static void __process_peer_state(struct peers *peers, struct peer *peer)