feat: ModeStream (Redis-like append-only log) - #50
Merged
Merged
Conversation
Add ModeStream: XAdd/XRange/XRevRange/XLen/XDel/XTrim with owner-minted millis-seq ids and a single opaque []byte payload. Snapshot fan-out (FlagStream + S/A/D/T); non-owner XAdd uses peer StreamAdd. Entry.Flags is uint64 so FlagStream can be 1<<32. XRevRange uses the same start/end window as XRange (newest first). Hard cap 4096 returns stream full. Client rejects int32 overflow on XTrim/count.
SuperCache bench vs
|
| cell | ops/s (main → PR) | Δ ops/s | p50 | p99 |
|---|---|---|---|---|
get/hit n=1 c=1 uniform |
8574 → 8742 | +2.0% | 116µs → 114µs | 195µs → 189µs |
get/hit n=1 c=10 uniform |
33495 → 33634 | +0.4% | 271µs → 268µs | 823µs → 821µs |
get/hit n=3 c=10 uniform |
38766 → 39093 | +0.8% | 227µs → 225µs | 892µs → 897µs |
miss/miss-cacheonly n=1 c=1 uniform |
8540 → 8424 | -1.4% | 116µs → 117µs | 213µs → 218µs |
miss/miss-cacheonly n=1 c=10 uniform |
35521 → 33617 | -5.4% | 254µs → 268µs | 804µs → 881µs |
set/put n=1 c=1 uniform |
8361 → 8484 | +1.5% | 117µs → 116µs | 223µs → 208µs |
set/put n=1 c=10 uniform |
32543 → 33229 | +2.1% | 279µs → 274µs | 851µs → 815µs |
Δ ops/s: green-ish is higher throughput. Latency: lower is better.
go test -bench (ns/op)
| benchmark | ns/op (main → PR) | Δ | allocs/op |
|---|---|---|---|
BenchmarkEngineDelete |
783 → 847 | +8.1% | 6 → 6 |
BenchmarkEngineGetHit |
1234 → 1252 | +1.5% | 15 → 15 |
BenchmarkEngineGetHitParallel |
1312 → 1199 | -8.6% | 15 → 15 |
BenchmarkEngineGetMissCacheOnly |
860 → 897 | +4.3% | 14 → 14 |
BenchmarkEngineGetMissCacheOnlyParallel |
635 → 635 | +0.0% | 14 → 14 |
BenchmarkEngineGetMissLoadThrough |
1609 → 1620 | +0.7% | 24 → 24 |
BenchmarkEngineGetMissLoadThroughParallel |
1873 → 1823 | -2.7% | 23 → 23 |
BenchmarkEnginePut |
1582 → 1623 | +2.6% | 18 → 18 |
BenchmarkEnginePutParallel |
1386 → 1458 | +5.2% | 18 → 18 |
BenchmarkStoreBitSet |
113 → 113 | +0.2% | 1 → 1 |
BenchmarkStoreCGetHit |
73 → 77 | +5.5% | 0 → 0 |
BenchmarkStoreCIncr |
101 → 105 | +3.3% | 1 → 1 |
BenchmarkStoreCMSIncr |
121 → 123 | +1.3% | 0 → 0 |
BenchmarkStoreCMSIncrN |
121 → 121 | -0.1% | 0 → 0 |
BenchmarkStoreGeoAdd |
9532 → 10127 | +6.2% | 2 → 2 |
BenchmarkStoreGeoPosHit |
89 → 89 | +0.2% | 0 → 0 |
BenchmarkStoreGeoPosMiss |
87 → 87 | +0.3% | 0 → 0 |
BenchmarkStoreGetHit |
292 → 293 | +0.5% | 2 → 2 |
BenchmarkStoreGetHitParallel |
357 → 346 | -3.0% | 2 → 2 |
BenchmarkStoreHGetHit |
91 → 92 | +0.9% | 1 → 1 |
BenchmarkStoreHGetMiss |
85 → 84 | -0.5% | 0 → 0 |
BenchmarkStoreHLLAdd |
100 → 103 | +3.2% | 0 → 0 |
BenchmarkStoreHSet |
10570 → 10980 | +3.9% | 3 → 3 |
BenchmarkStoreJsonSet |
26797 → 26757 | -0.1% | 207 → 207 |
BenchmarkStorePut |
304 → 343 | +12.7% | 2 → 2 |
BenchmarkStorePutParallel |
352 → 362 | +2.9% | 2 → 2 |
BenchmarkStoreSetAdd |
9213 → 9169 | -0.5% | 2 → 2 |
BenchmarkStoreSetContainsHit |
87 → 88 | +0.3% | 0 → 0 |
BenchmarkStoreSetContainsMiss |
84 → 84 | -0.5% | 0 → 0 |
BenchmarkStoreTopKAdd |
996 → 992 | -0.4% | 20 → 20 |
BenchmarkStoreVAdd |
107749 → 108433 | +0.6% | 512 → 512 |
BenchmarkStoreVSim |
89438 → 90059 | +0.7% | 530 → 530 |
BenchmarkStoreZAdd |
9862 → 9552 | -3.1% | 2 → 2 |
BenchmarkStoreZScoreHit |
86 → 86 | -0.4% | 0 → 0 |
BenchmarkStoreZScoreMiss |
86 → 86 | +0.2% | 0 → 0 |
Posted by CI bench job. Not a merge gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New keyspace mode
ModeStream: a Redis-like append-only log with owner-mintedmillis-seqids and one opaque[]bytepayload.Design: docs/design/2026-09-08-mode-stream.md
What landed vs the design
XAdd,XRange,XRevRange,XLen,XDel,XTrim; existingDelete(name)tombstones the stream(onstart;endis always inclusiveXAdduses peerStreamAddand returns the idFlagStream+Value[0]S); inboxA/D/Tstays owner-onlyEntry.Flagswidened touint64;FlagStream = 1<<32XRevRangeuses the samestart/endwindow asXRange(newest first) — not Redis high-then-low argument orderstream full; client rejectsint32overflow onXTrim/ rangecountsc xadd|xlen|xrange|xrevrange|xdel|xtrimXREAD, caller-chosen ids, Lab widget,examples/streamProduct docs
Updated in this PR:
docs/API.md,api/openapi/cache.openapi.yaml+docs/apisnapshot (0.14.0),PLAN.md,docs/OPERATIONS.md,docs/CLUSTER_FLOWS.md,README.md,cmd/schelp/README,docs/design/README.md.Test plan
go test ./...(local, green)test+bench; read<!-- supercache-bench-comment -->Bench risk
uint32→uint64widensstore.Entryby 4 bytes. Could move StoreGetHit ns/op; must not raise Get-hit / StoreGetHit allocs/op.