fix(config-repl): wire handle_config_request() to send real bytes

Replace NULL sha256/bytes stub with xce_replconfig_reply_raw() call.
Primary now sends actual config blob and SHA-256 in OP_replConfig reply.
This commit is contained in:
Rongsong Shen 2026-05-21 13:16:38 +00:00
parent 26393e919c
commit 4ef2089fd4

View file

@ -23,6 +23,7 @@
#include "clusterconfig.h" #include "clusterconfig.h"
#include "cluster.h" #include "cluster.h"
#include "ha.h" #include "ha.h"
#include "request.h"
#include "utils.h" #include "utils.h"
#include "wobj.h" #include "wobj.h"
#include "xce/cluster_def.h" #include "xce/cluster_def.h"
@ -649,21 +650,17 @@ int handle_config_request(cluster_t *c, endpoint_t *ep, xce_request_t *req)
return -EIO; return -EIO;
} }
reply.status = 0; int rc2 = xce_replconfig_reply_raw(ep, c->myhost, req->seq,
rmsg->up_to_date = 0; my_tag,
rmsg->version_tag = my_tag; recomputed, 32,
/* sha256 and bytes are xce_data_t* — raw-byte encoding is wired in Task 11. bytes, blen);
* For now set to NULL so encode_Data_ptr emits capn_null pointers.
* The standby will fall through to its saved config on this path until
* Task 11 completes the typemap shims. */
rmsg->sha256 = NULL;
rmsg->bytes = NULL;
xce_reply(ep, c->myhost, &reply);
free(bytes); free(bytes);
/* rmsg is no longer needed — xce_replconfig_reply_raw builds capnp directly */
free(rmsg); free(rmsg);
reply.data.replconfigreplymsg = NULL; reply.data.replconfigreplymsg = NULL;
return 0; if (rc2 != 0)
ERROR("handle_config_request: xce_replconfig_reply_raw failed: %d", rc2);
return rc2;
} }
/* ── fetch_config_from_primary helpers ─────────────────────── */ /* ── fetch_config_from_primary helpers ─────────────────────── */