Skip to content

Polish: honest consistency docs, hardened failure demo, join/leave + CI - #2

Merged
tomlin7 merged 2 commits into
mainfrom
cursor/merge-ready-polish-2e50
Sep 13, 2026
Merged

tomlin7 merged 2 commits into
mainfrom
cursor/merge-ready-polish-2e50

Conversation

@tomlin7

@tomlin7 tomlin7 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

PR #1 already merged. This is merge-ready polish on that MVP — no rewrite, no AI.

Why

The merged demo grepped the whole /ring JSON for "node-b". That string is always present in the cluster nodes list, so the “key owned by node-b” picker could pick a key that node-b does not own.

What changed

  • Failure demo parses owners[] only. Two scenarios:
    • A: SET acked by both owners, kill one replica → GET still hits
    • B: SET while an owner is down (acked=1), kill the surviving copy → GET misses
  • Consistency is the README lead: success is acked≥1, not linearizable; R=2 sync fan-out; last-writer-wins; no persistence
  • 60-second path: ./scripts/quickstart.sh (or make cluster + curl)
  • Join/leave: POST/DELETE /admin/members (local, not gossip) + ./scripts/rebalance-demo.sh (~1/N remap)
  • CI: gofmt, vet, -race, then both demo scripts against a local 3-node cluster
  • Small correctness nits: read-repair no longer cancels its own RPCs; Store.Close is idempotent

How to run (60s)

./scripts/quickstart.sh
./scripts/failure-demo.sh
./scripts/rebalance-demo.sh
make stop

Verified on this agent VM (2026-09-13)

  • make ci (gofmt, go vet, go test ./... -race)
  • ./scripts/quickstart.sh — SET user:1 acked 2/2, GET via node-b hit
  • Failure demo A: demo:failure-a:1 owners [node-b, node-a], SET acked 2/2; after kill, :8080/:8082 served node-a; :8081 down
  • Failure demo B: demo:failure-b:1 owners [node-b, node-a]; SET while node-b down → acked=1 failed=[node-b]; kill node-a → GET :8082 503
  • Rebalance: 617/2000 = 0.308 primaries remapped on join (N=3→4); leave restored 2000/2000
  • Bench (loopback, this commit, 2026-09-13T10:55:13Z, 4 vCPU Xeon): SET 9395 ops/s p99 8.90ms; GET 10583 ops/s p99 11.31ms. A quieter same-day slot was ~12.8k / ~31k — both labeled, neither is an SLO
  • Docker was not available on this VM; compose path not re-run here

Honesty

Best-effort sync replication. Success is acked≥1. Last-writer-wins. Static-unless-you-POST membership. No persistence.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 13, 2026 10:54
Fix the failure-demo key picker so it reads owners[] instead of grepping
the whole /ring body (which always contains node-b). Add scenario B
(partial ACK then kill the only copy). Document the consistency contract
up front, add a 60s quickstart, join/leave remapping, and GitHub Actions.

Co-authored-by: dheeraj <hello@tomlin7.com>
Replace the quieter-slot ops/s with numbers measured on this commit
(hardware and date labeled). Note the earlier same-day run so the
spread is honest. Tidy demo GET lines to include HTTP status.

Co-authored-by: dheeraj <hello@tomlin7.com>
@tomlin7
tomlin7 marked this pull request as ready for review September 13, 2026 11:10
@tomlin7
tomlin7 merged commit 4eda671 into main Sep 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants