This commit is contained in:
Rongsong Shen 2026-07-23 12:35:10 +08:00
commit ff1be48001
38 changed files with 2292 additions and 35 deletions

View file

@ -404,6 +404,9 @@ static int myreq_handler(vtask_t* task)
case OPCode_clrpreason:
rc = do_clr_preason(c, ep, &request);
break;
case OPCode_fetchfile:
rc = on_fetchfile(c, ep, &request);
break;
case OPCode_requestVote: {
/* Task 6.3: delegate vote-request handling to raft library.
*
@ -691,22 +694,41 @@ static int myreq_handler(vtask_t* task)
}
break;
#endif
case OPCode_reply:
/* Config-push ACK arriving on an inbound standby endpoint (the
* join.c-registered standby_endpoints channel — these eps reply on
* the same connection the primary pushed on, so the ACK lands here
* instead of peer_ctrl_msg_handler). Feed it to the replicator so
* the configAck barrier can observe it (ha-commit-barrier-rollout
* task 5.2 remediation r1; same ingestion as
* repl_ack_decode_and_dispatch in ha.c — completes the unlanded
* half of ha-config-bootstrap task 8.1). */
case OPCode_reply: {
/* Reply arriving on an inbound endpoint. Two independent producers
* feed this case:
* 1. fetchfile proxy replies from a worker (fetchfile feature) —
* routed to the pending waiter via fetchfile_signal.
* 2. Config-push ACKs arriving on an inbound standby endpoint (the
* join.c-registered standby_endpoints channel — these eps reply
* on the same connection the primary pushed on, so the ACK
* lands here instead of peer_ctrl_msg_handler). Fed to the
* replicator so the configAck barrier can observe it
* (ha-commit-barrier-rollout task 5.2 remediation r1; same
* ingestion as repl_ack_decode_and_dispatch in ha.c — completes
* the unlanded half of ha-config-bootstrap task 8.1). */
xce_reply_t* workreply = request.body.replymsg;
if (workreply != NULL && workreply->opcode == OPCode_fetchfile) {
xce_fetchfile_reply_t* fr =
(workreply->data_which == RequestReply_data_fetchfilereply)
? workreply->data.fetchfilereply
: NULL;
uint64_t jid = fr ? fr->jobid : 0;
fetchfile_signal(jid, workreply->status, fr);
/* Ownership of fr transfers to the pending waiter. */
workreply->data.fetchfilereply = NULL;
rc = 0;
break;
}
if (request.body_which == Request_body_replymsg
&& request.body.replymsg
&& request.body.replymsg->data_which
&& workreply != NULL
&& workreply->data_which
== RequestReply_data_replconfigpushreplymsg
&& request.body.replymsg->data.replconfigpushreplymsg) {
&& workreply->data.replconfigpushreplymsg) {
repl_config_push_reply_t *cack =
request.body.replymsg->data.replconfigpushreplymsg;
workreply->data.replconfigpushreplymsg;
if (cack->accepted) {
repl_on_config_ack(&c->persist.repl, ep, cack->version_tag);
TRACE("myreq_handler: config ACK from inbound standby"
@ -718,8 +740,10 @@ static int myreq_handler(vtask_t* task)
rc = 0;
break;
}
/* Any other reply body keeps the legacy unknown-opcode handling. */
/* fall through */
}
default:
rc = -E_XCE_BAD_OPCODE;
ERROR("Unknown opcode: %d", request.opcode);