feat(controller): clusterconfig-schema-split task 6.1 — CLI flags for hash-table tunables (optional, Req 6)

Adds 11 new CLI flags (--jobmgr-nhash/-delta, --workermgr-nhash/-delta,
--qmgr-nhash/-delta, --resmgr-nhash/-delta/-inst-delta,
--xstrings-nhash/-delta) mirroring the existing --vcpus OPT_*+struct
arguments+myconf_t pattern. Zero behavior change until task 6.2 wires
these into init_controller_tunables().

Review flagged two naming/coverage gaps for task 6.2 to resolve:
xstrings_delta has no corresponding cluster_t.tunables field yet, and
resmgr_inst_delta maps to tunables' existing resmgr_inst by name only.
This commit is contained in:
Rongsong Shen 2026-07-21 07:33:32 +00:00
parent edd79562a4
commit c3107b954a
3 changed files with 156 additions and 1 deletions

View file

@ -93,7 +93,7 @@
- _Depends: 4_
- [ ] 6. (Optional — Requirement 6, nice-to-have, deferrable without blocking the rest of this spec) CLI-Configurable Performance Tunables
- [ ] 6.1 Add CLI flags for the hash-table tunables
- [x] 6.1 Add CLI flags for the hash-table tunables
- Add `--jobmgr-nhash`, `--workermgr-nhash`, `--qmgr-nhash`, `--resmgr-nhash`, `--xstrings-nhash` (and corresponding `-delta`/`-inst` variants where the tunable has more than one dimension) following the same `OPT_*` + `struct arguments` + `myconf_t` pattern already used for `--vcpus`
- Observable: `xce_controller --help` lists all new flags; passing one populates the corresponding `myconf_t` field
- _Requirements: 6.1_

View file

@ -33,6 +33,17 @@ const char* argp_program_bug_address = BUG_EMAIL;
#define OPT_WAL_SYNC 262
#define OPT_MAX_WAL_RECORDS 263
#define OPT_WAL_SEGMENT_BYTES 264
#define OPT_JOBMGR_NHASH 265
#define OPT_JOBMGR_DELTA 266
#define OPT_WORKERMGR_NHASH 267
#define OPT_WORKERMGR_DELTA 268
#define OPT_QMGR_NHASH 269
#define OPT_QMGR_DELTA 270
#define OPT_RESMGR_NHASH 271
#define OPT_RESMGR_DELTA 272
#define OPT_RESMGR_INST_DELTA 273
#define OPT_XSTRINGS_NHASH 274
#define OPT_XSTRINGS_DELTA 275
struct arguments {
char* myname;
@ -48,6 +59,17 @@ struct arguments {
uint32_t wal_sync_ms;
uint32_t max_wal_records;
uint32_t wal_segment_bytes;
uint32_t jobmgr_nhash;
uint32_t jobmgr_delta;
uint32_t workermgr_nhash;
uint32_t workermgr_delta;
uint32_t qmgr_nhash;
uint32_t qmgr_delta;
uint32_t resmgr_nhash;
uint32_t resmgr_delta;
uint32_t resmgr_inst_delta;
uint32_t xstrings_nhash;
uint32_t xstrings_delta;
};
static struct argp_option options[] = {
@ -77,6 +99,29 @@ static struct argp_option options[] = {
"Physical WAL segment file size in bytes; a segment is only eligible "
"for trim/delete after it rotates out (0 = default 64 MB; persist "
"enforces a minimum of 4096)" },
{ "jobmgr-nhash", OPT_JOBMGR_NHASH, "N", 0,
"Hash-table slot count for the job manager (0 = use hardcoded default)" },
{ "jobmgr-delta", OPT_JOBMGR_DELTA, "N", 0,
"Hash-table growth step for the job manager (0 = use hardcoded default)" },
{ "workermgr-nhash", OPT_WORKERMGR_NHASH, "N", 0,
"Hash-table slot count for the worker manager (0 = use hardcoded default)" },
{ "workermgr-delta", OPT_WORKERMGR_DELTA, "N", 0,
"Hash-table growth step for the worker manager (0 = use hardcoded default)" },
{ "qmgr-nhash", OPT_QMGR_NHASH, "N", 0,
"Hash-table slot count for the queue manager (0 = use hardcoded default)" },
{ "qmgr-delta", OPT_QMGR_DELTA, "N", 0,
"Hash-table growth step for the queue manager (0 = use hardcoded default)" },
{ "resmgr-nhash", OPT_RESMGR_NHASH, "N", 0,
"Hash-table slot count for the resource manager (0 = use hardcoded default)" },
{ "resmgr-delta", OPT_RESMGR_DELTA, "N", 0,
"Hash-table growth step for the resource manager (0 = use hardcoded default)" },
{ "resmgr-inst-delta", OPT_RESMGR_INST_DELTA, "N", 0,
"Growth step for the resource manager's shared-instance array "
"(0 = use hardcoded default)" },
{ "xstrings-nhash", OPT_XSTRINGS_NHASH, "N", 0,
"Hash-table slot count for the interned-string table (0 = use hardcoded default)" },
{ "xstrings-delta", OPT_XSTRINGS_DELTA, "N", 0,
"Hash-table growth step for the interned-string table (0 = use hardcoded default)" },
{ 0 }
};
@ -147,6 +192,83 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state)
arguments->wal_segment_bytes = (uint32_t)v;
break;
}
case OPT_JOBMGR_NHASH: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--jobmgr-nhash must be >= 0 (got: %s)", arg);
arguments->jobmgr_nhash = (uint32_t)v;
break;
}
case OPT_JOBMGR_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--jobmgr-delta must be >= 0 (got: %s)", arg);
arguments->jobmgr_delta = (uint32_t)v;
break;
}
case OPT_WORKERMGR_NHASH: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--workermgr-nhash must be >= 0 (got: %s)", arg);
arguments->workermgr_nhash = (uint32_t)v;
break;
}
case OPT_WORKERMGR_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--workermgr-delta must be >= 0 (got: %s)", arg);
arguments->workermgr_delta = (uint32_t)v;
break;
}
case OPT_QMGR_NHASH: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--qmgr-nhash must be >= 0 (got: %s)", arg);
arguments->qmgr_nhash = (uint32_t)v;
break;
}
case OPT_QMGR_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--qmgr-delta must be >= 0 (got: %s)", arg);
arguments->qmgr_delta = (uint32_t)v;
break;
}
case OPT_RESMGR_NHASH: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--resmgr-nhash must be >= 0 (got: %s)", arg);
arguments->resmgr_nhash = (uint32_t)v;
break;
}
case OPT_RESMGR_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--resmgr-delta must be >= 0 (got: %s)", arg);
arguments->resmgr_delta = (uint32_t)v;
break;
}
case OPT_RESMGR_INST_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--resmgr-inst-delta must be >= 0 (got: %s)", arg);
arguments->resmgr_inst_delta = (uint32_t)v;
break;
}
case OPT_XSTRINGS_NHASH: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--xstrings-nhash must be >= 0 (got: %s)", arg);
arguments->xstrings_nhash = (uint32_t)v;
break;
}
case OPT_XSTRINGS_DELTA: {
int v = atoi(arg);
if (v < 0)
argp_error(state, "--xstrings-delta must be >= 0 (got: %s)", arg);
arguments->xstrings_delta = (uint32_t)v;
break;
}
default:
return ARGP_ERR_UNKNOWN;
}
@ -202,6 +324,17 @@ int main(int argc, char* argv[])
arguments.wal_sync_ms = 0; /* 0 = not set; use persist config default */
arguments.max_wal_records = 0; /* 0 = not set; use persist config default */
arguments.wal_segment_bytes = 0; /* 0 = not set; use persist config default */
arguments.jobmgr_nhash = 0; /* 0 = not set; use cluster tunables default */
arguments.jobmgr_delta = 0; /* 0 = not set; use cluster tunables default */
arguments.workermgr_nhash = 0; /* 0 = not set; use cluster tunables default */
arguments.workermgr_delta = 0; /* 0 = not set; use cluster tunables default */
arguments.qmgr_nhash = 0; /* 0 = not set; use cluster tunables default */
arguments.qmgr_delta = 0; /* 0 = not set; use cluster tunables default */
arguments.resmgr_nhash = 0; /* 0 = not set; use cluster tunables default */
arguments.resmgr_delta = 0; /* 0 = not set; use cluster tunables default */
arguments.resmgr_inst_delta = 0; /* 0 = not set; use cluster tunables default */
arguments.xstrings_nhash = 0; /* 0 = not set; use cluster tunables default */
arguments.xstrings_delta = 0; /* 0 = not set; use cluster tunables default */
argp_parse(&argp, argc, argv, 0, 0, &arguments);
@ -254,6 +387,17 @@ int main(int argc, char* argv[])
myconf.wal_sync_ms = arguments.wal_sync_ms;
myconf.max_wal_records = arguments.max_wal_records;
myconf.wal_segment_bytes = arguments.wal_segment_bytes;
myconf.jobmgr_nhash = arguments.jobmgr_nhash;
myconf.jobmgr_delta = arguments.jobmgr_delta;
myconf.workermgr_nhash = arguments.workermgr_nhash;
myconf.workermgr_delta = arguments.workermgr_delta;
myconf.qmgr_nhash = arguments.qmgr_nhash;
myconf.qmgr_delta = arguments.qmgr_delta;
myconf.resmgr_nhash = arguments.resmgr_nhash;
myconf.resmgr_delta = arguments.resmgr_delta;
myconf.resmgr_inst_delta = arguments.resmgr_inst_delta;
myconf.xstrings_nhash = arguments.xstrings_nhash;
myconf.xstrings_delta = arguments.xstrings_delta;
memset(&myconf.peers_cfg, 0, sizeof(myconf.peers_cfg));
if (arguments.peers_str) {

View file

@ -39,6 +39,17 @@ typedef struct {
uint32_t wal_sync_ms; /* --wal-sync-ms; 0 = use persist default */
uint32_t max_wal_records; /* --max-wal-records; 0 = use persist default */
uint32_t wal_segment_bytes; /* --wal-segment-bytes; 0 = use persist default */
uint32_t jobmgr_nhash; /* --jobmgr-nhash CLI value; 0 = use hardcoded default */
uint32_t jobmgr_delta; /* --jobmgr-delta CLI value; 0 = use hardcoded default */
uint32_t workermgr_nhash; /* --workermgr-nhash CLI value; 0 = use hardcoded default */
uint32_t workermgr_delta; /* --workermgr-delta CLI value; 0 = use hardcoded default */
uint32_t qmgr_nhash; /* --qmgr-nhash CLI value; 0 = use hardcoded default */
uint32_t qmgr_delta; /* --qmgr-delta CLI value; 0 = use hardcoded default */
uint32_t resmgr_nhash; /* --resmgr-nhash CLI value; 0 = use hardcoded default */
uint32_t resmgr_delta; /* --resmgr-delta CLI value; 0 = use hardcoded default */
uint32_t resmgr_inst_delta; /* --resmgr-inst-delta CLI value; 0 = use hardcoded default */
uint32_t xstrings_nhash; /* --xstrings-nhash CLI value; 0 = use hardcoded default */
uint32_t xstrings_delta; /* --xstrings-delta CLI value; 0 = use hardcoded default */
} myconf_t;
extern cluster_config_t* get_default_conf(void*);