Commit Graph
4 Commits
Author SHA1 Message Date
Claude d56181503e Fix cluster not responding after restart
Two bugs prevented the cluster from working after a stop/start cycle:

1. tcp_listen_tcp() and tcp_listen_tls() had reuse_addr set to false,
   causing bind() to fail with EADDRINUSE when ports are in TIME_WAIT
   state after a restart. Set SO_REUSEADDR to true.

2. The vsr_boot_marker file (created in CWD on first boot) was never
   cleaned up on cluster stop. On restart, all nodes would enter
   STATUS_RECOVERY, but since RECOVERY messages are only processed by
   nodes in STATUS_NORMAL, the entire cluster would deadlock with no
   node able to recover. Remove the marker in cluster.sh stop.

https://claude.ai/code/session_01U72omHJrk95xFwm22Rkqgt
2026-02-26 01:02:21 +00:00
Claudeandcozis 7cd124e939 Add cluster management script for 3 server nodes and 1 HTTP proxy
Provides start/stop/status/restart/clean commands to manage a local
ToastyFS cluster. Nodes listen on 127.0.0.1:8001-8003 with the HTTP
proxy on 127.0.0.1:3000. Each node gets its own chunk storage directory
under cluster-data/. Logs and PID files are stored there as well.

https://claude.ai/code/session_01FAL4T35UGYqXexbaxvihRp
2026-02-26 01:19:36 +01:00
cozis ef1d65ad2b Major refactoring 2026-02-25 10:44:43 +01:00
Claude 96bd81bae6 Add library build, local cluster script, and example client
Introduce a Makefile that builds libtoastyfs.a and libtoastyfs.so from the
client-side sources (client, tcp, byte_queue, message, basic) so external
programs can link against the ToastyFS client API in include/toastyfs.h.

Add cluster.sh, a convenience script that manages a local 3-node cluster
by spawning toastyfs server processes on ports 8081-8083.  Sub-commands:
up, down, status, logs, and "run <source.c>" which builds the library,
compiles the source against it, starts the cluster, runs the binary, and
tears everything down.

Add examples/example.c demonstrating synchronous PUT, GET, DELETE, and a
NOT_FOUND verification.

Fix a stack overflow in the MAIN_SERVER entry point: ServerState is ~40 MB
(MetaStore holds 4096 ObjectMeta entries) and was declared on the stack.
Heap-allocate it instead.

https://claude.ai/code/session_019DVhmc25jfzcHnmdNxzib2
2026-02-21 14:51:14 +00:00