@@ -407,72 +407,20 @@ typedef enum {
407407 CC_NODE_ACTIVE = 1 /* fully participating, sends ALIVE */
408408} cc_node_state_t ;
409409
410- /* TODO: maintenance mode
410+ /* Planned: node maintenance mode (see the module documentation roadmap).
411411 *
412- * Add CC_NODE_MAINTENANCE = 2 to cc_node_state_t. A node in maintenance
413- * must never become master, must not participate in elections (treated as
414- * absent from cc_elect_master), and must not become active shtag holder for
415- * any cluster even when manage_shtags=1.
412+ * A CC_NODE_MAINTENANCE state would let a node be drained without leaving the
413+ * cluster: never elected master, excluded from cc_elect_master (advertised in
414+ * the ALIVE payload so peers drop it from the election window without waiting
415+ * for a MEMBER_LIST refresh), and never the active sharing-tag holder even
416+ * with manage_shtags=1. It is local policy, so it would live in cc_cluster_t
417+ * (not the shared peer table) and survive MEMBER_LIST resets, toggled by a
418+ * local MI command.
416419 *
417- * Entry / exit: new MI command cc_maintenance {on|off} sets the flag on the
418- * local node. Advertise the state in the ALIVE payload so all peers know to
419- * exclude this node from elections without waiting for a MEMBER_LIST refresh.
420- * The maintenance flag should survive MEMBER_LIST resets (it is local policy,
421- * not part of the cluster-wide peer table - store it in cc_cluster_t, not
422- * cc_peer_t).
423- *
424- * In cc_elect_master: skip any peer whose ALIVE-advertised maintenance flag
425- * is set (treat it as not in the election window even if last_seen is fresh).
426- *
427- * In cc_transition_to_active and shtag activation paths: gate all
428- * activate_backup_shtags / set_active_shtag calls behind
429- * if (cl->peers->node_state != CC_NODE_MAINTENANCE)
430- *
431- * TODO: shtag override mode
432- *
433- * Add MI command cc_set_shtag_holder <cluster_id> <node_ip> to force a
434- * specific non-maintenance node to be the active shtag holder for a cluster,
435- * overriding the normal master-drives-shtag logic. Persist the override in
436- * a new field cc_peers_t.shtag_override_ip[CC_MAX_IP_LEN+1] (in shm so
437- * it is visible across processes).
438- *
439- * When shtag_override_ip is set for a cluster:
440- * - the designated node calls set_active_shtag regardless of mastership
441- * - all other nodes stay in backup shtag state
442- * - the override is NOT cleared on MEMBER_LIST or key rotation - it is
443- * explicit operator intent and must be cleared only by
444- * cc_clear_shtag_override (see below) or automatically when the
445- * overridden node enters maintenance mode
446- * - if the overridden node is put into maintenance mode, the override is
447- * automatically cleared and normal master-driven shtag logic resumes
448- *
449- * TODO: shtag override clear
450- *
451- * Add MI command cc_clear_shtag_override <cluster_id> to cancel a
452- * previously set shtag override and return the cluster to normal mode where
453- * the elected master drives shtag activation.
454- *
455- * Implementation:
456- * - zero cc_peers_t.shtag_override_ip for the cluster
457- * - the current master immediately calls set_active_shtag on itself and
458- * activate_backup_shtags on all other nodes, restoring normal state
459- * - non-master nodes that were held in backup shtag state due to the
460- * override need no explicit action - the next election cycle reapplies
461- * correct shtag assignments automatically
462- * - log at INFO: "shtag override cleared for cluster <id>, resuming
463- * normal master-driven shtag assignment (master: <ip>)"
464- * - return error if no override is active for the given cluster_id
465- *
466- * TODO: MI status commands
467- *
468- * cc_list_shtags - list all clusters with their active shtag holder,
469- * whether the holder was elected normally or overridden, and which nodes
470- * are in maintenance mode. Output columns: cluster_id, shtag, holder_ip,
471- * status in {elected | overridden | maintenance | no_holder}.
472- *
473- * cl_ctr_list_members should be extended to include a 'mode' field per node:
474- * active | maintenance, and an 'shtag_status' field: holder | backup |
475- * overridden | n/a (when manage_shtags=0 for that cluster).
420+ * It would build on what is already here: the sharing-tag override
421+ * (cl_ctr_shtag_force / cl_ctr_shtag_auto) would auto-clear when the forced
422+ * node enters maintenance, and cl_ctr_list_members / cl_ctr_list_config would
423+ * gain a per-node maintenance indicator alongside the existing shtag_mode.
476424 */
477425
478426/* =========================================================================
0 commit comments