Skip to content

Fix temp-column/shard eviction race: 1s minimum item lifetime + atomic LRU#11

Open
carli2 wants to merge 1 commit intomasterfrom
MP-stabilize
Open

Fix temp-column/shard eviction race: 1s minimum item lifetime + atomic LRU#11
carli2 wants to merge 1 commit intomasterfrom
MP-stabilize

Conversation

@carli2
Copy link
Contributor

@carli2 carli2 commented Mar 3, 2026

Summary

Cherry-pick of the Go storage fixes from c988df4, without the queryplan.scm scalar-subquery changes.

  • cache.go: add registeredAt int64 to softItem; evict() skips any item whose max(registeredAt, lastUsed) is less than 1s old — guarantees minimum lifetime for every cached item
  • scan_helper.go: touchTempColumns now refreshes all temp columns of the scanned table (not just those in the scan's column lists), preventing concurrent eviction during an active scan
  • shard.go / partition.go / database.go / storage.go / index.go: change storageShard.lastAccessed from time.Time (non-atomic 24-byte struct) to uint64 UnixNano with atomic.LoadUint64/StoreUint64 everywhere — removes the data race on shardLastUsed() / indexLastUsed() / keytableLastUsed()

Test plan

  • CI green on the Go storage tests
  • Memory pressure / eviction tests (29/29 pass on original commit)

🤖 Generated with Claude Code

…c LRU

Cherry-picked Go storage changes from c988df4 (without queryplan.scm changes):
- cache.go: add registeredAt int64 to softItem; evict() skips items <1s old
- scan_helper.go: touchTempColumns refreshes ALL temp columns of scanned table
- shard.go / partition.go / database.go / storage.go / index.go:
  change storageShard.lastAccessed from time.Time to uint64 UnixNano with
  atomic.LoadUint64/StoreUint64 everywhere, removing the data race

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant