Fix client timeout propagation and add operation retry logic

The client library had several issues preventing operations from completing
in the simulation:

- toastyfs_register_events discarded the computed timeout instead of
  returning it to callers, so clients never woke up on schedule
- random_client_tick ignored the timeout parameter entirely
- deadline_to_timeout truncated sub-millisecond values to 0 instead of
  rounding up, causing busy-wait loops
- The server didn't reset the heartbeat timer after completing a view
  change, so followers would immediately timeout again
- The client's DELETE handler didn't handle META_RESULT_NOT_FOUND,
  causing an assertion failure when deleting non-existent keys
- Most critically, messages sent before TCP connections were established
  were silently dropped with no retry mechanism — added timeout-based
  retry logic in toastyfs_process_events

https://claude.ai/code/session_0184gHjra7fsmSPZ4kppaGhC
This commit is contained in:
Claude
2026-02-21 14:08:07 +00:00
parent 6e60b41f1b
commit 8233392871
5 changed files with 53 additions and 10 deletions
+3 -4
View File
@@ -82,12 +82,12 @@ int random_client_init(void *state_, int argc, char **argv,
return -1;
state->started = false;
*timeout = 0;
if (pcap < TCP_POLL_CAPACITY) {
fprintf(stderr, "Random client :: Not enough poll capacity\n");
return -1;
}
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap);
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap, timeout);
*timeout = 0; // Ensure first tick fires immediately to start an operation
return 0;
}
@@ -142,8 +142,7 @@ int random_client_tick(void *state_, void **ctxs,
}
}
(void) timeout;
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap);
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap, timeout);
return 0;
}