fix bug-1060 bug-1067
This commit is contained in:
parent
6067ba6c94
commit
61e1391cd0
28 changed files with 7021 additions and 2926 deletions
|
|
@ -11,6 +11,12 @@
|
|||
#include "request.h"
|
||||
#include "wal_types.h" /* WAL_CONFIG_MARKER, WAL_CONFIG_MARKER_PAYLOAD_LEN */
|
||||
|
||||
/* Forward decl: ha_stream_wal_to_standby takes a persist handle by pointer only
|
||||
* (for the authoritative per-LSN term index via persist_entry_term). Avoids a
|
||||
* heavy persist.h include in this header. */
|
||||
struct persist_s;
|
||||
typedef struct persist_s persist_t;
|
||||
|
||||
/* Max config blob size — reject before allocating */
|
||||
#define CONF_MAX_SIZE (1 * 1024 * 1024) /* 1 MiB */
|
||||
|
||||
|
|
@ -362,16 +368,31 @@ int handle_upgrade_config(cluster_t *c, endpoint_t *ep, xce_request_t *req);
|
|||
* Parameters:
|
||||
* ep — outbound endpoint to the standby
|
||||
* wal_path — directory containing WAL segment files (seg-*.wal)
|
||||
* p — persist handle for the AUTHORITATIVE per-LSN term index
|
||||
* (persist_entry_term). Each streamed entry's term and the
|
||||
* AppendEntries prev_log_term MUST come from this index, NOT
|
||||
* the raw on-disk hdr.term — the standby's logOk and the
|
||||
* library send path both use persist_entry_term, which maps a
|
||||
* legacy-0 entry to WAL_LEGACY_TERM. Sourcing raw hdr.term (0)
|
||||
* for a legacy entry diverges from the standby's normalized
|
||||
* term (1) → logOk rejects forever (bug-1028). May be NULL only
|
||||
* in count-only unit tests that do not assert terms.
|
||||
* standby_lsn — standby's last applied LSN (stream starts at standby_lsn+1)
|
||||
* committed_lsn— primary's committed LSN (stream ends at committed_lsn inclusive)
|
||||
*
|
||||
* Returns 0 on success; negative on internal error (e.g., NULL ep).
|
||||
* Requirements: 5.1, 5.2, 5.4, 5.5 (ha-repl-hardening spec)
|
||||
* Requirements: 5.1, 5.2, 5.4, 5.5 (ha-repl-hardening spec); bug-1028.
|
||||
* Boundary: WAL Streaming (config_repl.c)
|
||||
*/
|
||||
#define WAL_STREAM_BATCH_ENTRIES 256
|
||||
#define WAL_STREAM_BATCH_BYTES 65536
|
||||
/* bug-1067: leader_term is the streaming leader's CURRENT term — stamped onto
|
||||
* each streamed entry's leader_current_term so the standby intake uses it as the
|
||||
* AppendEntries header term (UpdateTerm/stale-check), distinct from each entry's
|
||||
* stored term (logOk/persist). Historical catch-up entries have a stored term
|
||||
* BELOW leader_term; using the stored term as the AE term stale-rejected them. */
|
||||
int ha_stream_wal_to_standby(endpoint_t *ep, const char *wal_path,
|
||||
const persist_t *p, uint64_t leader_term,
|
||||
uint64_t standby_lsn, uint64_t committed_lsn);
|
||||
|
||||
#define SNAPSHOT_CHUNK_SIZE 65536
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue