build: fix 7 risky warnings + slim debug profile to -g1
Warning fixes (from a 730-warning full-build census; these were the semantically risky ones): - test_repl_majority.c:272: remove a broken "field-existence" loop whose condition (i < ep != NULL) parsed wrong (-Wparentheses); the direct pending_ack_count write it guarded already exists and still fails the build if the field disappears. - ha.c:8593: ha_rdhup_election_hook now takes const xce_candidate_t** so RDHUP election can hand over candidates straight from the const peers_cfg without stripping const. All 5 test-side hook impls only (void)peers -- signature updated in ha.h + 3 test files. - ha.c:726/872/10804 endpoint_connect: constify the host parameter of endpoint_connect/socket_connect (netio.h/netio.c). The functions only pass host to gethostbyname(); peer->hostname etc. can now flow in without discarding const. All callers are read-only and unaffected. Debug profile (src/meson.build): drop -gdwarf-4 -g3 -fvar-tracking(-assignments) in favor of -ggdb -g1. Debug objects were ~16x larger with full DWARF (scheduler.c: 1.3MB vs 0.08MB), pushing the build tree to 3.9G; at -g1 it is 850M and a clean build drops from 6m43s to 4m36s. -g1 keeps file/line and backtraces; gdb variable/ macro inspection needs the asan profile. -fno-omit-frame-pointer kept. Verified: controller_unit_test 1342/1342, xcelib_test 758/758, all 126 scheduler suites + 18 worker suites green; modified sources compile with zero warnings. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
edb63e6095
commit
f1801fbef9
9 changed files with 24 additions and 27 deletions
|
|
@ -262,7 +262,7 @@ static void test_rdhup_on_minus_one_fd_is_safe(void)
|
|||
* async re-election (Req 6.3, 6.5, 9.3).
|
||||
*/
|
||||
extern void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name);
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ static int g_rdhup_hook_n_peers = -1;
|
|||
static ha_state_t *g_rdhup_hook_ha = NULL;
|
||||
|
||||
static void rdhup_election_spy(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1503,7 +1503,7 @@ extern int ha_prevote_active_round_timer_for_test(uint64_t *round_out,
|
|||
extern void ha_prevote_round_timer_clear_for_test(void);
|
||||
extern _Atomic int ha_liveness_arm_count_for_test;
|
||||
extern void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name);
|
||||
|
||||
|
|
@ -1705,7 +1705,7 @@ static void test_r2_f2_refused_promotion_steps_down_and_rearms(void)
|
|||
*/
|
||||
static int g_r2_election_spy_calls = 0;
|
||||
static void r2_election_spy(ha_state_t *ha, cluster_t *c, int n_peers,
|
||||
xce_candidate_t **peers, uint64_t tag,
|
||||
const xce_candidate_t **peers, uint64_t tag,
|
||||
uint64_t lsn, const char *name)
|
||||
{
|
||||
(void)ha; (void)c; (void)n_peers; (void)peers; (void)tag; (void)lsn;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ extern int (*ha_phase2_hook)(void *c);
|
|||
extern int (*ha_push_config_hook)(void *c);
|
||||
extern int (*ha_send_ctrlhello_hook)(void *c);
|
||||
extern void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name);
|
||||
|
||||
|
|
@ -115,7 +115,8 @@ typedef struct {
|
|||
static rdhup_hook_state_t g_rdhup_state;
|
||||
|
||||
static void rdhup_election_drives_evaluate(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers,
|
||||
const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag,
|
||||
uint64_t my_lsn,
|
||||
const char *my_name)
|
||||
|
|
@ -401,7 +402,7 @@ static void test_rdhup_primary_dispatch_gate_opens(void)
|
|||
static int g_guard_hook_calls = 0;
|
||||
|
||||
static void counting_election_hook(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name)
|
||||
{
|
||||
|
|
@ -521,7 +522,7 @@ static uint64_t g_captured_my_lsn = 0;
|
|||
static uint64_t g_captured_my_tag = 0;
|
||||
|
||||
static void capture_lsn_hook(ha_state_t *ha, cluster_t *c,
|
||||
int n_peers, xce_candidate_t **peers,
|
||||
int n_peers, const xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -268,13 +268,8 @@ static void test_broadcast_over_limit_removes_standby(void)
|
|||
repl_add_standby(&r, &ep0, "sb0", 7000);
|
||||
|
||||
/* Artificially inflate pending_ack_count past the limit.
|
||||
* After overflow the standby should be evicted (in_catch_up=1 or removed). */
|
||||
for (int i = 0; i < r.standbys[0].ep != NULL ? 1 : 0; i++) {
|
||||
/* Access the pending_ack_count field — this will fail to compile if
|
||||
* the field does not exist on standby_conn_t */
|
||||
r.standbys[0].pending_ack_count = MAX_PENDING_ACKS + 1;
|
||||
}
|
||||
/* Also verify the field exists via a direct write */
|
||||
* After overflow the standby should be evicted (in_catch_up=1 or removed).
|
||||
* This also fails to compile if the field is missing on standby_conn_t. */
|
||||
r.standbys[0].pending_ack_count = MAX_PENDING_ACKS + 1;
|
||||
|
||||
/* Broadcast a wal entry — the over-limit standby should be evicted */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue