forked from lei.chen/myxce
Add redirect helpers to ha.c/ha.h so a standby controller never accepts join requests as if it were the primary: - ha_should_redirect(): returns 1 when role is STANDBY and primary_host/port are known — caller should send E_XCE_REDIRECT. - ha_no_primary_known(): returns 1 when role is STANDBY but primary address is not yet known — caller should send E_XCE_NOMASTER (retry later). - Add E_XCE_NOMASTER and E_XCE_REDIRECT to errnox.h. - Wire both guards into handle_join_() in join.c (before the role switch) so all join types (worker, scheduler, apiserver, client) are protected. - Full redirect response sends status=-E_XCE_REDIRECT with nodata body; the primary host:port are logged so operators can trace misrouted clients. Full Cap'n Proto RedirectInfo response body is deferred to a follow-up (schema union would require regenerating capnp bindings). 5 new TDD tests — 110 total, 0 failures. |
||
|---|---|---|
| .. | ||
| controller_test.c | ||
| test.c | ||
| test_cluster_persist.c | ||
| test_e2e_capnp.c | ||
| test_e2e_checkpoint.c | ||
| test_e2e_gc.c | ||
| test_e2e_hooks.c | ||
| test_e2e_wal.c | ||
| test_gc_retention.c | ||
| test_ha_cluster.c | ||
| test_ha_redirect.c | ||
| test_ha_role.c | ||
| test_hooks.c | ||
| test_persist_checkpoint.c | ||
| test_persist_hooks.c | ||
| test_persist_recovery.c | ||
| test_persist_schema.c | ||
| test_persist_types.c | ||
| test_persist_wal.c | ||