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
+1
View File
@@ -517,6 +517,7 @@ complete_view_change_and_become_primary(ServerState *state)
broadcast_to_peers_ex(state, &begin_view_message.base, state->log.entries, state->log.count * sizeof(LogEntry));
clear_view_change_fields(state);
state->heartbeat = state->now;
return HR_OK;
}