Closed
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Description
Problem
A reused arenaskl Inserter can miss equality when the requested key is exactly the cached base-level splice successor. The cached-splice fast path starts the remaining descent below level 0, so that successor is not compared again and a duplicate node can be published.
Reproduction
- Insert the even keys with the normal skiplist API.
- Reuse one Inserter while adding all keys in sorted order.
- Existing even keys should return ErrRecordExists, but without an explicit cached-successor equality check duplicate nodes can be admitted.
Impact
The bug violates the skiplist unique-key contract for callers that reuse Inserter across sorted, overlapping input. It also prevents safely using the splice cache to speed up exact COUNT(DISTINCT) state merges.
Expected fix
Check equality with the cached successor before leaving the cached base-level splice path, and add a regression that verifies both duplicate rejection and final cardinality.
Discovered while optimizing #27672.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Activity
XuPeng-SH commentedon Aug 26, 2026
Fix is included in #27688 (head
353ed46e82): cached base-level successor equality is checked before leaving the Inserter fast path, with a sorted-overlap regression covering duplicate rejection and final cardinality. #27688 now owns and closes this issue; #27693 will consume the shared fix after rebase.perf: linearize DISTINCT aggregate preflight deduplication (#27688)
perf: linearize DISTINCT aggregate preflight deduplication (matrixori…
perf: linearize DISTINCT aggregate preflight deduplication (matrixori…
perf: linearize DISTINCT aggregate preflight deduplication (matrixori…