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.
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
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.