Skip to content

Commit ccdfbae

Browse files
EmericBrwtarreau
authored andcommitted
MINOR: peers: add informative flags about resync process for debugging
This patch adds miscellenous informative flags raised during the initial full resync process performed during the reload for debugging purpose. 0x00000010: Timeout waiting for a full resync from a local node 0x00000020: Timeout waiting for a full resync from a remote node 0x00000040: Session aborted learning from a local node 0x00000080: Session aborted learning from a remote node 0x00000100: A local node teach us and was fully up to date 0x00000200: A remote node teach us and was fully up to date 0x00000400: A local node teach us but was partially up to date 0x00000800: A remote node teach us but was partially up to date 0x00001000: A local node was assigned for a full resync 0x00002000: A remote node was assigned for a full resync 0x00004000: A resync was explicitly requested This patch could be backported on any supported branch
1 parent 1a6b43e commit ccdfbae

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

src/peers.c

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,23 @@
5252
/******************************/
5353
/* Current peers section resync state */
5454
/******************************/
55-
#define PEERS_F_RESYNC_LOCAL 0x00000001 /* Learn from local finished or no more needed */
56-
#define PEERS_F_RESYNC_REMOTE 0x00000002 /* Learn from remote finished or no more needed */
57-
#define PEERS_F_RESYNC_ASSIGN 0x00000004 /* A peer was assigned to learn our lesson */
58-
#define PEERS_F_RESYNC_PROCESS 0x00000008 /* The assigned peer was requested for resync */
59-
#define PEERS_F_DONOTSTOP 0x00010000 /* Main table sync task block process during soft stop
60-
to push data to new process */
55+
#define PEERS_F_RESYNC_LOCAL 0x00000001 /* Learn from local finished or no more needed */
56+
#define PEERS_F_RESYNC_REMOTE 0x00000002 /* Learn from remote finished or no more needed */
57+
#define PEERS_F_RESYNC_ASSIGN 0x00000004 /* A peer was assigned to learn our lesson */
58+
#define PEERS_F_RESYNC_PROCESS 0x00000008 /* The assigned peer was requested for resync */
59+
#define PEERS_F_RESYNC_LOCALTIMEOUT 0x00000010 /* Timeout waiting for a full resync from a local node */
60+
#define PEERS_F_RESYNC_REMOTETIMEOUT 0x00000020 /* Timeout waiting for a full resync from a remote node */
61+
#define PEERS_F_RESYNC_LOCALABORT 0x00000040 /* Session aborted learning from a local node */
62+
#define PEERS_F_RESYNC_REMOTEABORT 0x00000080 /* Session aborted learning from a remote node */
63+
#define PEERS_F_RESYNC_LOCALFINISHED 0x00000100 /* A local node teach us and was fully up to date */
64+
#define PEERS_F_RESYNC_REMOTEFINISHED 0x00000200 /* A remote node teach us and was fully up to date */
65+
#define PEERS_F_RESYNC_LOCALPARTIAL 0x00000400 /* A local node teach us but was partially up to date */
66+
#define PEERS_F_RESYNC_REMOTEPARTIAL 0x00000800 /* A remote node teach us but was partially up to date */
67+
#define PEERS_F_RESYNC_LOCALASSIGN 0x00001000 /* A local node was assigned for a full resync */
68+
#define PEERS_F_RESYNC_REMOTEASSIGN 0x00002000 /* A remote node was assigned for a full resync */
69+
#define PEERS_F_RESYNC_REQUESTED 0x00004000 /* A resync was explicitly requested */
70+
#define PEERS_F_DONOTSTOP 0x00010000 /* Main table sync task block process during soft stop
71+
to push data to new process */
6172

6273
#define PEERS_RESYNC_STATEMASK (PEERS_F_RESYNC_LOCAL|PEERS_F_RESYNC_REMOTE)
6374
#define PEERS_RESYNC_FROMLOCAL 0x00000000
@@ -948,6 +959,10 @@ void __peer_session_deinit(struct peer *peer)
948959
peer->flags &= ~(PEER_F_LEARN_ASSIGN);
949960
peers->flags &= ~(PEERS_F_RESYNC_ASSIGN|PEERS_F_RESYNC_PROCESS);
950961

962+
if (peer->local)
963+
peers->flags |= PEERS_F_RESYNC_LOCALABORT;
964+
else
965+
peers->flags |= PEERS_F_RESYNC_REMOTEABORT;
951966
/* reschedule a resync */
952967
peers->resync_timeout = tick_add(now_ms, MS_TO_TICKS(5000));
953968
}
@@ -2085,6 +2100,7 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
20852100

20862101
/* flag to start to teach lesson */
20872102
peer->flags |= PEER_F_TEACH_PROCESS;
2103+
peers->flags |= PEERS_F_RESYNC_REQUESTED;
20882104
}
20892105
else if (msg_head[1] == PEER_MSG_CTRL_RESYNCFINISHED) {
20902106
TRACE_PROTO("received control message", PEERS_EV_CTRLMSG,
@@ -2093,6 +2109,10 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
20932109
peer->flags &= ~PEER_F_LEARN_ASSIGN;
20942110
peers->flags &= ~(PEERS_F_RESYNC_ASSIGN|PEERS_F_RESYNC_PROCESS);
20952111
peers->flags |= (PEERS_F_RESYNC_LOCAL|PEERS_F_RESYNC_REMOTE);
2112+
if (peer->local)
2113+
peers->flags |= PEERS_F_RESYNC_LOCALFINISHED;
2114+
else
2115+
peers->flags |= PEERS_F_RESYNC_REMOTEFINISHED;
20962116
}
20972117
peer->confirm++;
20982118
}
@@ -2103,6 +2123,10 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
21032123
peer->flags &= ~PEER_F_LEARN_ASSIGN;
21042124
peers->flags &= ~(PEERS_F_RESYNC_ASSIGN|PEERS_F_RESYNC_PROCESS);
21052125

2126+
if (peer->local)
2127+
peers->flags |= PEERS_F_RESYNC_LOCALPARTIAL;
2128+
else
2129+
peers->flags |= PEERS_F_RESYNC_REMOTEPARTIAL;
21062130
peer->flags |= PEER_F_LEARN_NOTUP2DATE;
21072131
peers->resync_timeout = tick_add(now_ms, MS_TO_TICKS(PEER_RESYNC_TIMEOUT));
21082132
task_wakeup(peers->sync_task, TASK_WOKEN_MSG);
@@ -2431,6 +2455,7 @@ static inline void init_accepted_peer(struct peer *peer, struct peers *peers)
24312455
/* assign local peer for a lesson, consider lesson already requested */
24322456
peer->flags |= PEER_F_LEARN_ASSIGN;
24332457
peers->flags |= (PEERS_F_RESYNC_ASSIGN|PEERS_F_RESYNC_PROCESS);
2458+
peers->flags |= PEERS_F_RESYNC_LOCALASSIGN;
24342459
}
24352460

24362461
}
@@ -2439,6 +2464,7 @@ static inline void init_accepted_peer(struct peer *peer, struct peers *peers)
24392464
/* assign peer for a lesson */
24402465
peer->flags |= PEER_F_LEARN_ASSIGN;
24412466
peers->flags |= PEERS_F_RESYNC_ASSIGN;
2467+
peers->flags |= PEERS_F_RESYNC_REMOTEASSIGN;
24422468
}
24432469
}
24442470

@@ -2492,6 +2518,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
24922518
/* assign peer for a lesson */
24932519
peer->flags |= PEER_F_LEARN_ASSIGN;
24942520
peers->flags |= PEERS_F_RESYNC_ASSIGN;
2521+
peers->flags |= PEERS_F_RESYNC_REMOTEASSIGN;
24952522
}
24962523
}
24972524

@@ -2955,6 +2982,7 @@ struct task *process_peer_sync(struct task * task, void *context, unsigned int s
29552982

29562983
/* flag no more resync from local, to try resync from remotes */
29572984
peers->flags |= PEERS_F_RESYNC_LOCAL;
2985+
peers->flags |= PEERS_F_RESYNC_LOCALTIMEOUT;
29582986

29592987
/* reschedule a resync */
29602988
peers->resync_timeout = tick_add(now_ms, MS_TO_TICKS(PEER_RESYNC_TIMEOUT));
@@ -3000,6 +3028,7 @@ struct task *process_peer_sync(struct task * task, void *context, unsigned int s
30003028
/* assign peer for the lesson */
30013029
ps->flags |= PEER_F_LEARN_ASSIGN;
30023030
peers->flags |= PEERS_F_RESYNC_ASSIGN;
3031+
peers->flags |= PEERS_F_RESYNC_REMOTEASSIGN;
30033032

30043033
/* wake up peer handler to handle a request of resync */
30053034
appctx_wakeup(ps->appctx);
@@ -3070,6 +3099,7 @@ struct task *process_peer_sync(struct task * task, void *context, unsigned int s
30703099

30713100
/* flag no more resync from remote, consider resync is finished */
30723101
peers->flags |= PEERS_F_RESYNC_REMOTE;
3102+
peers->flags |= PEERS_F_RESYNC_REMOTETIMEOUT;
30733103
}
30743104

30753105
if ((peers->flags & PEERS_RESYNC_STATEMASK) != PEERS_RESYNC_FINISHED) {

0 commit comments

Comments
 (0)