Fix request_id mismatch causing 5s hang on every PUT commit
The COMMIT_PUT message was built with request_id N, then request_id was incremented to N+1 immediately after sending. When the server replied with request_id N, the client compared it against N+1, silently discarded the reply, and waited for the 5-second timeout. The timeout retry (replay_request) then resent with N+1, which matched — so every PUT paid an unnecessary 5-second penalty. Move the request_id++ before building the CommitPutMessage, matching the pattern already used by toastyfs_async_delete. https://claude.ai/code/session_01EG3WZSH3ZeTdAbb5T42r2w
This commit is contained in:
+1
-1
@@ -455,6 +455,7 @@ static int process_message(ToastyFS *tfs,
|
||||
begin_transfers(tfs);
|
||||
if (all_chunk_transfers_completed(tfs)) {
|
||||
|
||||
tfs->request_id++;
|
||||
CommitPutMessage msg = {
|
||||
.base = {
|
||||
.version = MESSAGE_VERSION,
|
||||
@@ -477,7 +478,6 @@ static int process_message(ToastyFS *tfs,
|
||||
msg.oper.chunks[i].size = tfs->chunk_sizes[i];
|
||||
}
|
||||
send_message_to_server(tfs, leader_idx(tfs), &msg.base);
|
||||
tfs->request_id++;
|
||||
tfs->step = STEP_COMMIT;
|
||||
client_log(tfs, "SEND COMMIT_PUT", "key=%s chunks=%d req=%lu",
|
||||
tfs->key, tfs->num_chunks, tfs->request_id);
|
||||
|
||||
Reference in New Issue
Block a user