caching: pool trimmed append-only mem leases#835
caching: pool trimmed append-only mem leases#835snissn wants to merge 5 commits intopr/get-cap-trim-retentionfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Improves TreeDB caching’s post-flush/checkpoint trimming so that append-only memtables dropped from the strong “lease” set are reset and returned to the appendOnlyMemPool (and any stale direct-arena lease association is released) to reduce reallocation pressure on subsequent rotations.
Changes:
- Pool dropped append-only memtables during
trimAppendOnlyMemLeasesinstead of discarding them. - Release any associated append-only direct arena lease before pooling the memtable.
- Add a unit test asserting trimmed leases are returned to the memtable pool.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Returns dropped append-only memtables to appendOnlyMemPool after hard reset and direct-arena lease release. |
| TreeDB/caching/retained_arena_trim_test.go | Adds a test intended to validate that trimmed append-only leases are pooled for reuse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR improves memory reuse in the caching layer by ensuring append-only memtables dropped during lease trimming are returned to the per-DB appendOnlyMemPool, and by releasing any associated direct-arena leases before pooling.
Changes:
- Return dropped append-only memtable leases to
db.appendOnlyMemPoolinstead of discarding them. - Release any append-only direct-arena lease association before pooling dropped memtables.
- Add a unit test intended to validate that trimmed leases are returned to the pool.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Pools trimmed append-only memtables and releases direct-arena lease associations before pooling. |
| TreeDB/caching/retained_arena_trim_test.go | Adds a test for verifying trimmed append-only leases are returned to the pool. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Improve append-only memtable lease trimming by pooling reset memtables (instead of discarding) and adding a regression test to ensure dropped leases are reusable, reducing allocation pressure during rotate cycles.
Changes:
- Return dropped append-only memtables to
appendOnlyMemPoolafter a hard reset. - Release stale direct-arena lease association before pooling.
- Add a unit test covering the “dropped leases returned to pool” behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Pools dropped append-only memtables during trimming and releases direct-arena lease associations. |
| TreeDB/caching/retained_arena_trim_test.go | Adds a regression test asserting trimmed leases become available for reuse via the mem pool. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
trimAppendOnlyMemLeasesdrops strong lease references, return the reset memtables toappendOnlyMemPoolinstead of discarding themTestTrimAppendOnlyMemLeases_DroppedLeasesReturnToPoolWhy
Previously, trim dropped append-only memtables on the floor after hard reset. That loses reusable entry-slice backing arrays and increases reallocation pressure on subsequent rotate cycles.
Validation