Skip to content

arenaskl: cached Inserter can admit a duplicate successor key #27691

Closed

Description

@XuPeng-SH

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

  1. Insert the even keys with the normal skiplist API.
  2. Reuse one Inserter while adding all keys in sorted order.
  3. 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.

Activity

  1. self-assigned this
    on Aug 26, 2026
  2. added
    kind/bug
    severity/s0
    on Aug 26, 2026
  3. XuPeng-SH commented on Aug 26, 2026

    @XuPeng-SH
    ContributorAuthor

    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.

  4. added a commit that references this issue on Aug 26, 2026
    a5eb8b6
  5. added 3 commits that reference this issue on Sep 17, 2026
    77536ec
    975953c
    50049c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions