Skip to content

feat(conflict): Add Tango signature cache - #882

Merged
behinddwalls merged 2 commits into
manjari/tango-signature-conversionfrom
manjari/tango-signature-cache
Oct 20, 2026
Merged

behinddwalls merged 2 commits into
manjari/tango-signature-conversionfrom
manjari/tango-signature-cache

Conversation

@manjari25

@manjari25 manjari25 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Why?

The Tango-backed conflict analyzer compares a new batch against the signature of every in-flight batch. Reading all of those from the signature store on every analysis would be slow, especially after a restart. This PR adds the in-memory cache that sits in front of the store.

What?

Everything is added under submitqueue/extension/conflict/tango:

  • Adds a byte-bounded LRU cache of TargetSignatures, keyed by queue and batch ID. One cache serves every queue, with a single memory budget, so a busy queue can use space an idle one left behind.
  • A lookup refreshes an entry's recency. Adding a signature evicts the least recently used entries until the cache is back within budget. A signature larger than the whole budget is not cached, and a zero budget caches nothing.
  • Entries are sized from their targets (16 bytes each) plus a fixed overhead. The figure is an estimate that keeps the budget tied to memory use.
  • Signatures are immutable, so a cached value is shared with callers instead of copied. Signatures can have millions of targets, and copying them on every read would defeat the cache. Nobody may modify Targets.
  • A miss costs one store read, never a call to Tango, so evicting an in-flight batch is safe. That is why there is no explicit eviction when a batch leaves the in-flight set.
  • The cache is unexported and nothing uses it yet. The analyzer that uses it is a later PR in this stack.
  • Tests cover hits and misses, queue, a read refreshing recency, repeated puts of one key not evicting a neighbour, an oversized signature, a zero budget, and a concurrent get and put test under -race.

Test Plan

./tool/bazel test //submitqueue/extension/conflict/tango/...
go test -race ./submitqueue/extension/conflict/tango/
make check-gazelle
make check-mocks
make lint
CI

Issue

@manjari25
manjari25 added this pull request to stack #883 October 16, 2026 20:28
@manjari25
manjari25 marked this pull request as ready for review October 16, 2026 22:01
@manjari25
manjari25 requested review from a team, behinddwalls and sbalabanov as code owners October 16, 2026 22:01
@manjari25
manjari25 force-pushed the manjari/tango-signature-cache branch from fe144a0 to 1fafd1f Compare October 16, 2026 22:06
Comment thread submitqueue/extension/conflict/tango/cache.go
@manjari25
manjari25 force-pushed the manjari/tango-signature-cache branch from 1fafd1f to cfb66ca Compare October 20, 2026 21:58
@manjari25
manjari25 added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Oct 20, 2026
@manjari25
manjari25 force-pushed the manjari/tango-signature-cache branch from cfb66ca to 11e4ede Compare October 20, 2026 22:21
@manjari25
manjari25 force-pushed the manjari/tango-signature-cache branch from 11e4ede to 4479878 Compare October 20, 2026 22:25
@behinddwalls
behinddwalls added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit c7a67dd Oct 20, 2026
20 checks passed
@behinddwalls
behinddwalls deleted the manjari/tango-signature-cache branch October 20, 2026 22:58
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