feat(ha-config-bootstrap): implement --vcpus CLI, wire validation, remove vcpus from config (task 2.2)
- Add --vcpus N argp option in main.c; store in myconf.vcpus - Replace inline argp guard with validate_vcpus() call (returns -EINVAL for <=0) - Add validate_startup_config() in startup_validation.c: returns 0; writes deprecation warning into caller-supplied warn_buf when vcpus key present - Wire validate_startup_config() into myapp_run() after conffile resolved; emit WARN() if warn_buf non-empty (Req 4.4) - Remove vcpus field from cluster_config_t (clusterconfig.h) - Preserve capnp ordinal: vcpus @7 -> vcpusDeprecated @7: Void in controller.capnp - vtaskmgr_init uses only myconf->vcpus with hardcoded default 8 - Add stub C types in typemap.h for capnp schema extensions from task 1.1 - 96 tests pass
This commit is contained in:
parent
bfa41eb135
commit
3ab2e6e4bf
12 changed files with 225 additions and 8 deletions
|
|
@ -37,7 +37,6 @@ typedef struct {
|
|||
int inactive_heartbeat_count;
|
||||
int fetch_job_interval;
|
||||
int netio_timeout;
|
||||
int vcpus;
|
||||
int nres;
|
||||
xce_resource_t** resources;
|
||||
int nqueues;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ typedef struct {
|
|||
uint64_t config_generation; /* monotonic audit counter */
|
||||
time_t conf_stale_timeout; /* seconds before saved config flagged stale (default 86400) */
|
||||
int conf_stale; /* 1 when saved config older than conf_stale_timeout */
|
||||
int vcpus; /* Req 4.3: --vcpus CLI value; 0 = use config default */
|
||||
} myconf_t;
|
||||
|
||||
extern cluster_config_t* get_default_conf(void*);
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ typedef struct {
|
|||
repl_config_push_reply_t* replconfigpushreplymsg;
|
||||
upgrade_config_reply_t* upgradeconfigreplymsg;
|
||||
} data;
|
||||
/* Req 7: standby redirect fields — populated when status == XCE_ERR_STANDBY */
|
||||
char *redirect_host;
|
||||
uint16_t redirect_port;
|
||||
} xce_reply_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -217,6 +220,61 @@ typedef struct {
|
|||
} body;
|
||||
} xce_request_t;
|
||||
|
||||
/* ── HA election and replication Cap'n Proto mapped types ────────────────
|
||||
* C-side counterparts for the HA protocol capnp structs added in the
|
||||
* ha-config-bootstrap spec (controller.capnp structs with $C.mapname).
|
||||
* Must be declared here so controller.capnp.h can reference them. */
|
||||
|
||||
typedef struct {
|
||||
uint64_t term;
|
||||
char *candidate_id;
|
||||
uint64_t config_tag;
|
||||
uint64_t last_log_lsn;
|
||||
} request_vote_req_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t term;
|
||||
int vote_granted;
|
||||
uint64_t peer_config_tag;
|
||||
uint64_t peer_last_log_lsn;
|
||||
} request_vote_reply_t;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
} probe_config_tag_req_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t config_tag;
|
||||
} probe_config_tag_reply_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t term;
|
||||
uint64_t lsn;
|
||||
} wal_ack_req_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t term;
|
||||
uint64_t lsn;
|
||||
int success;
|
||||
} wal_ack_reply_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t term;
|
||||
uint64_t acked_tag;
|
||||
int success;
|
||||
} upgrade_config_ack_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t snapshot_lsn;
|
||||
xce_data_t *payload;
|
||||
} snapshot_transfer_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t lsn;
|
||||
uint8_t entry_type;
|
||||
xce_data_t *payload;
|
||||
} wal_catchup_entry_t;
|
||||
|
||||
/* ── Persistence Cap'n Proto mapped types (P0-9) ─────────────────────
|
||||
* These are the C-side counterparts for the capnp encode/decode shims.
|
||||
* Named with capnp_ prefix to avoid collision with the plain-C structs
|
||||
|
|
@ -291,8 +349,10 @@ struct upgrade_config_reply_s {
|
|||
};
|
||||
|
||||
struct heartbeat_msg_s {
|
||||
uint32_t sender_priority; /* sender's HA priority */
|
||||
uint64_t term; /* sender's current term */
|
||||
uint32_t sender_priority; /* sender's HA priority */
|
||||
uint64_t term; /* sender's current term */
|
||||
uint64_t committed_lsn; /* Req 5: primary's committed WAL LSN */
|
||||
uint64_t committed_config_tag; /* Req 8: primary's committed config tag */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue