Repository navigation
Commit be7dbf2
committed
clusterer: controller-support API, gated behind a build-time flag
Groundwork for clusterer_controller (added later in this series): an API the
controller binds to, a way to declare which clusters it manages, and the hooks
that let a controller-managed cluster take its identity at runtime instead of
from the config.
Declaring a managed cluster uses a per-cluster 'cluster_options' modparam - the
same "key=value, key=value" idiom as my_node_info:
modparam("clusterer", "cluster_options", "cluster_id=1, use_controller=1")
cluster_id is required; use_controller is a 0/1 flag defaulting to 0 (native),
and only use_controller=1 pre-creates the controller-managed stub, which never
touches the DB and is guarded against hijacking a native cluster of the same id.
Native clusters need no cluster_options line at all, and every other clusterer
setting (db_mode, ping_*, my_node_id, sharing_tag, ...) stays a global modparam.
The interim 'use_controller' / 'cluster_id' int modparams (never released) are
kept registered only to fail with a migration hint.
The managed-id set is exported through the ctrl binds (managed_count /
managed_ids) so the controller can cross-check it pre-fork: a managed id with no
matching 'cluster' config has no BIN socket or crypto params, and a 'cluster'
config for an unmanaged id has nothing legitimate to drive. Either mismatch
aborts at startup naming the offending id, rather than half-forming a cluster.
All of it is compiled only under CLUSTERER_CTRL_SUPPORT:
- the clusterer_ctrl API (clusterer_ctrl.c) and the cluster_options modparam
plus the load_clusterer_ctrl_binds export;
- the controller stub pre-create loop, the child_init guard, the shm
current_id mirror, the on-demand stub, and the shtag_managed /
controller_managed logic;
- the per-cluster identity and hybrid-db_mode accessors (cluster_self_id,
cl_db_mode, GET_CURRENT_ID, use_controller), which get #else fallbacks to
the stock globals (current_id / db_mode / 0) so their call sites compile to
the exact upstream object code with no per-site #ifdef. add_node_info's
internal self_id parameter is gated the same way.
The top-level Makefile exports CLUSTERER_CTRL_SUPPORT=1 iff clusterer_controller
is in the configured build - derived from the include/exclude lists rather than
the current 'modules' subset, so it is stable across 'make all' and a
single-module rebuild - and clusterer/Makefile turns that into the -D.
The point of the gate: a build without clusterer_controller produces the stock
clusterer module. No cluster_options parameter (rejected as unknown), no
behavioural change, no added exports. Verified with
'unifdef -UCLUSTERER_CTRL_SUPPORT' against the base - no semantic difference
from upstream. Enabling the controller rebuilds clusterer with the hooks; the
two are a matched pair.1 parent 01d6f6d commit be7dbf2
12 files changed
Lines changed: 1293 additions & 66 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
9 | 17 | | |
0 commit comments