forked from lei.chen/myxce
chore: checkpoint all prior work for clean state
Captures all uncommitted work from ha-config-bootstrap, ha-heartbeat-liveness, and associated spec/tooling updates: - src: ha.c, ha.h, cluster.c, config_repl.c, myapp.c, raft.c — heartbeat liveness, RDHUP integration, committing phase fixes - tests: test_ha_role.c, test_config_repl.c, test_ha_rdhup_integration.c, test_p1_integration.c, test_p3_hardening.c, scheduler test - specs: election-iomgr-refactor, ha-heartbeat-liveness, ha-peer-connection-reuse, raft-library (new); ha-config-bootstrap and election-iomgr-refactor task/research updates - tooling: .wolf/ state, ha/data cluster fixtures, raft/raft.tla, src/build symlink, xce-build skill update
This commit is contained in:
parent
15bd291bdd
commit
e31673dd88
66 changed files with 122422 additions and 860 deletions
|
|
@ -142,30 +142,6 @@ static void test_p3_promote_demote_cycle_consistent_role(void)
|
|||
printf("test_p3_promote_demote_cycle_consistent_role: PASS\n");
|
||||
}
|
||||
|
||||
/* Heartbeat timeout with a known primary must set failover_requested
|
||||
* (replicates the critical path exercised by the watchdog). */
|
||||
static void test_p3_heartbeat_timeout_sets_failover_flag(void)
|
||||
{
|
||||
ha_state_t ha;
|
||||
ha_config_t cfg = make_p3_ha_cfg();
|
||||
TEST_ASSERT_EQUAL_INT(0, ha_init(&ha, &cfg, 1 /* not highest priority */));
|
||||
|
||||
/* Seed a known primary so the timeout check fires */
|
||||
strncpy(ha.primary_host, "dead-primary", XCE_MAXNAME_LEN - 1);
|
||||
ha.primary_port = 7788;
|
||||
|
||||
/* Force an expired heartbeat timestamp */
|
||||
clock_gettime(CLOCK_MONOTONIC, &ha.last_heartbeat);
|
||||
ha.last_heartbeat.tv_sec -= 30; /* 30 s ago — far past 10 s timeout */
|
||||
|
||||
ha_check_heartbeat_nocluster(&ha);
|
||||
|
||||
TEST_ASSERT_TRUE(
|
||||
atomic_load_explicit(&ha.failover_requested, memory_order_acquire) != 0);
|
||||
|
||||
ha_fini(&ha);
|
||||
printf("test_p3_heartbeat_timeout_sets_failover_flag: PASS\n");
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* P3-2: Redirect state-machine corner cases
|
||||
|
|
@ -478,7 +454,6 @@ void test_p3_hardening(void)
|
|||
/* P3-1: Failover state machine */
|
||||
printf("-- P3-1: Failover state machine --\n");
|
||||
RUN_TEST(test_p3_promote_demote_cycle_consistent_role);
|
||||
RUN_TEST(test_p3_heartbeat_timeout_sets_failover_flag);
|
||||
|
||||
/* P3-2: Redirect corner cases */
|
||||
printf("-- P3-2: Redirect --\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue