Live symptom: jobsub intermittently failed with 'Connection timed out' even though the cluster had quorum. Root cause: the synchronous commit barrier waits only DEFAULT_SYNC_TIMEOUT_MS=50ms for durable majority replication, and that was not configurable. 50ms is too tight for durable sync majority replication — especially since standbys now fdatasync each replicated entry before ACK — so a multi-entry jobsub's later WAL entry intermittently misses the window: commit: WAIT deadline expired without commit (lsn=3 committed_lsn=2 timeout_ms=50) -> persist hook returns -ETIMEDOUT -> handle_jobsubmit rejects -> client ETIMEDOUT. Fix: - Raise DEFAULT_SYNC_TIMEOUT_MS 50 -> 500 (config.h) — realistic for durable sync majority replication, still bounded for failure detection. - Add a --sync-timeout-ms controller flag threaded arguments -> myconf -> persist pcfg (override applied before persist_init); 0 = use default, positive overrides — so operators can tune per environment. TDD: literal-pinned persist_config_defaults().sync_timeout_ms == 500. All timeout-sensitive tests already pass an explicit timeout_ms (none rely on the default), so none are slowed; full controller suite green under ASAN. No commit-engine/barrier/replication/wire change beyond the default value + plumbing. bug-561.
49 lines
1.8 KiB
C
49 lines
1.8 KiB
C
#if !defined(_MYCONF_H_)
|
|
|
|
#define _MYCONF_H_ 1
|
|
|
|
#define MAX_MASTER_CANDIDATES (64)
|
|
|
|
#include <time.h>
|
|
#include <stdint.h>
|
|
|
|
#include <tlog.h>
|
|
|
|
#include "clusterconfig.h"
|
|
#include "xce/cluster.h"
|
|
|
|
/* Forward declaration — avoids circular include with cluster_def.h */
|
|
typedef struct cluster_s cluster_t;
|
|
|
|
struct logging {
|
|
char* logdir;
|
|
char* loglevel;
|
|
};
|
|
|
|
typedef struct {
|
|
cluster_config_t* cluster_config;
|
|
char* conffile;
|
|
char* certfile;
|
|
char* keyfile;
|
|
char* workdir; /* working directory for WAL/snapshot storage */
|
|
char* name; /* controller name (hostname by default) */
|
|
xce_cluster_config_t peers_cfg; /* HA peer list parsed from --peers; count==0 = single-node */
|
|
uint64_t config_version_tag; /* first 8 bytes of SHA-256, host order */
|
|
uint8_t config_sha256[32]; /* full SHA-256 of conffile bytes */
|
|
int conf_keep_n; /* versioned file retention count (default 2) */
|
|
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 */
|
|
uint32_t sync_timeout_ms; /* --sync-timeout-ms; 0 = use persist default */
|
|
} myconf_t;
|
|
|
|
extern cluster_config_t* get_default_conf(void*);
|
|
extern int add_config(void*, char*, char*);
|
|
|
|
void myconf_fini(myconf_t *myconf);
|
|
|
|
int load_primary_config(cluster_t *c);
|
|
int fetch_config_from_primary(cluster_t *c);
|
|
|
|
#endif
|