Skip to content

Commit 504c6ce

Browse files
author
Joao Eduardo Luis
committed
doc: Add Paxos call chain to doc/mon/
Signed-off-by: Joao Eduardo Luis <[email protected]>
1 parent 05469b2 commit 504c6ce

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

doc/mon/README.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
paxos-call-chain.dot describes to some detail the call chain involved in the
2+
Paxos algorithm, paying special consideration to the messages involved.
3+
4+
This information is not easily obtainable by Doxygen, as it does not follow
5+
the call chain when messages are involved, since it becomes an async workflow.
6+
7+
To obtain the graph one should run
8+
9+
dot -T<format> paxos-call-chain.dot -o paxos-call-chain.<format>
10+
11+
e.g.,
12+
13+
dot -Tps paxos-call-chain.dot -o paxos-call-chain.ps
14+
15+
or
16+
17+
dot -Tpng paxos-call-chain.dot -o paxos-call-chain.png
18+
19+
It should do the trick.
20+
21+
Also, for future reference, we consider that:
22+
- boxed nodes refer to the Leader;
23+
- elliptical nodes refer to the Peon;
24+
- diamond shaped nodes refer to state changes;
25+
- dotted lines illustrate a message being sent from the Leader to the Peon,
26+
or vice-versa.
27+

doc/mon/paxos-call-chain.dot

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
digraph Paxos {
2+
concentrate=true
3+
// subgraph cluster0 {
4+
collect -> state_recovering;
5+
collect -> send_mmp_collect -> handle_collect [style=dotted];
6+
handle_collect -> send_mmp_last;
7+
send_mmp_last -> handle_last [style=dotted];
8+
handle_last -> collect [label="collect(last_pn)"];
9+
handle_last -> send_mmp_commit;
10+
handle_last -> state_active;
11+
handle_last -> begin;
12+
handle_last -> extend_lease;
13+
14+
// color=grey;
15+
// style=filled;
16+
// label="Post-Election call chain";
17+
// }
18+
19+
election_finished -> leader_init;
20+
leader_init -> collect [label="collect(0)"];
21+
send_mmp_commit -> handle_commit [style=dotted];
22+
23+
begin -> state_updating;
24+
begin -> send_mmp_begin;
25+
begin -> commit;
26+
27+
send_mmp_begin -> handle_begin [style=dotted];
28+
handle_begin -> state_updating;
29+
handle_begin -> send_mmp_accept;
30+
send_mmp_accept -> handle_accept [style=dotted];
31+
32+
handle_accept -> extend_lease;
33+
handle_accept -> state_active;
34+
handle_accept -> commit;
35+
36+
extend_lease -> send_mmp_lease;
37+
send_mmp_lease -> handle_lease [style=dotted];
38+
handle_lease -> state_active;
39+
handle_lease -> send_mmp_lease_ack;
40+
send_mmp_lease_ack -> handle_lease_ack [style=dotted];
41+
42+
commit -> send_mmp_commit;
43+
commit -> "last_committed++" [shape=box];
44+
send_mmp_commit -> handle_commit [style=dotted];
45+
46+
handle_commit -> store_state;
47+
48+
propose_pending -> propose_new_value;
49+
propose_new_value -> begin;
50+
51+
election_finished [label="Election Finished", shape=box, bgcolor=grey, style=filled];
52+
collect [label="collect()", shape=box];
53+
commit [label="commit()", shape=box];
54+
begin [label="begin()", shape=box];
55+
extend_lease [label="extend_lease()", shape=box];
56+
store_state [label="store_state()"]; // peon
57+
58+
propose_pending [label="PaxosService::propose_pending()"];
59+
propose_new_value [label="propose_new_value"];
60+
61+
send_mmp_collect [label="send(OP_COLLECT)", shape=box];
62+
send_mmp_last [label="send(OP_LAST)"];
63+
send_mmp_commit [label="send(OP_COMMIT)", shape=box];
64+
send_mmp_begin [label="send(OP_BEGIN)", shape=box];
65+
send_mmp_accept [label="send(OP_ACCEPT)"];
66+
send_mmp_lease [label="send(OP_LEASE)", shape=box];
67+
send_mmp_lease_ack [label="send(OP_LEASE_ACK)"];
68+
69+
handle_collect [label="handle_collect()"];
70+
handle_last [label="handle_last()", shape=box];
71+
handle_begin [label="handle_begin()"];
72+
handle_accept [label="handle_accept()", shape=box];
73+
handle_lease [label="handle_lease()"];
74+
handle_lease_ack [label="handle_lease_ack()", shape=box];
75+
handle_commit [label="handle_commit()"];
76+
77+
leader_init [label="Paxos::leader_init()", shape=box];
78+
79+
state_recovering [label="RECOVERING", shape=diamond];
80+
state_active [label="ACTIVE", shape=diamond];
81+
state_updating [label="UPDATING", shape=diamond];
82+
}

0 commit comments

Comments
 (0)