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

Commit 6135f68

Browse files
committed
Increase raft verbosity.
1 parent e6b4f3d commit 6135f68

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

contrib/raftable/raft/include/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct timeval ms2tv(int ms);
4848

4949
#define shout(...) \
5050
do { \
51+
fprintf(stderr, "RAFT: "); \
5152
fprintf(stderr, __VA_ARGS__); \
5253
fflush(stderr); \
5354
} while (0)

contrib/raftable/raft/src/raft.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ void raft_tick(raft_t r, int msec) {
649649
if (r->timer < 0) {
650650
switch (r->role) {
651651
case FOLLOWER:
652-
debug(
652+
shout(
653653
"lost the leader,"
654654
" claiming leadership\n"
655655
);
@@ -659,7 +659,7 @@ void raft_tick(raft_t r, int msec) {
659659
raft_claim(r);
660660
break;
661661
case CANDIDATE:
662-
debug(
662+
shout(
663663
"the vote failed,"
664664
" claiming leadership\n"
665665
);
@@ -1055,6 +1055,7 @@ static void raft_handle_claim(raft_t r, raft_msg_claim_t *m) {
10551055
reply.granted = true;
10561056
}
10571057
finish:
1058+
shout("voting %s\n", reply.granted ? "yes" : "no");
10581059
raft_send(r, candidate, &reply, sizeof(reply));
10591060
}
10601061

0 commit comments

Comments
 (0)