Skip to content

Commit 1f8d2a2

Browse files
committed
broker: add inline groups documentation
Problem: some code in broker/groups.c is not obvious even to the author after some time elapsed. Add some comments that mention the two extant use cases for groups (both broker internal) and document the reason why the a groups.join request is saved, and why there can only be one per group.
1 parent 16cd5b7 commit 1f8d2a2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/broker/groups.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
* Optimization: collect contemporaneous JOIN/LEAVE requests at each
3131
* rank for a short time before applying them and sending them upstream.
3232
* During that time, JOINs/LEAVEs of the same key may be combined.
33+
*
34+
* broker.online use case:
35+
* Groups are used for instance quorum detection. The state machine calls
36+
* groups.join broker.online in the QUORUM state on all ranks. Rank 0 calls
37+
* groups.get broker.online which notifies the broker as membership evolves,
38+
* and when the quorum condition is satisfied, the state transitions
39+
* to RUN. The 'broker.online' group is also monitored by the resource module
40+
* so that it can inform the scheduler as execution targets go up/down.
41+
*
42+
* broker.torpid use case:
43+
* A broker.torpid group is maintained by the broker overlay (see overlay.c).
44+
* The resource module also monitors broker.torpid and drains torpid nodes.
3345
*/
3446

3547
#if HAVE_CONFIG_H
@@ -50,6 +62,10 @@
5062

5163
static const double batch_timeout = 0.1;
5264

65+
/* N.B. only one client can join a group per broker. That client
66+
* join request is cached in group->join_request so that when the client
67+
* disconnects, we can identify its groups and force it to leave.
68+
*/
5369
struct group {
5470
char *name; // used directly as zhashx key
5571
struct idset *members;

0 commit comments

Comments
 (0)