Dead local_stop path in __wt_session_range_truncate

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines - Foundations
    • 1,533.486
    • None
    • None

      Problem

      In __wt_session_range_truncate (src/session/session_api.c), the local variable local_stop is declared and initialized to false, and checked at the cleanup branch to decide whether to close a locally-created stop cursor. Nothing in the function ever assigns local_stop = true. The symmetric counterpart local_start is assigned true when start is auto-created; stop has no equivalent auto-creation path.

      Result: the if (local_stop) close branch is unreachable; stop always falls through to the reset path.

      Impact

      • Dead code confuses readers into thinking there is a case where the function owns a stop cursor it needs to close.
      • If the symmetric "auto-create stop" logic was intended but never implemented, the current behavior may be subtly wrong for callers expecting symmetry between start and stop handling.

      Proposed fix

      Two options:

      1. Remove the dead code: delete the local_stop declaration, initialization, and the if (local_stop) branch.
      2. Mirror local_start: auto-create stop when appropriate, making the existing branch reachable.

      Option 1 is safe and the likely right choice unless option 2 was the original intent.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: