ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • DB Integration & Observability
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview

      AsyncResultsMerger::RemoteCursorData::exhausted() returns only "cursorId == 0" (the remote cursor is closed), but the name reads as "the remote is truly done". Several call sites use it to decide whether the shard still holds server-side cursor resources that must be killed or released. For those sites, "cursor is closed" is the correct condition, but the name hides that intent and has already caused confusion about what "exhausted" guarantees.

      Proposed change

      Split the two meanings explicitly:
      * Keep the "cursor closed" predicate (either keep the name exhausted() with a corrected doc, or rename it to cursorIsClosed()).
      * Add a separate remoteCursorIsOpen() predicate (cursorId != 0) and use it at the resource-management call sites that only care about cursor-resource status: _shouldKillRemote(), closeShardCursors(), and the partial-results cleanup path.

      This is a purely mechanical, behavior-preserving change. Existing tests should pass unchanged.

      Notes

      Split out of SERVER-134598 ("Refactor ARM to clarify retry behavior", PR 62606) so that the state-machine refactor diff stays focused. The same disambiguation was prototyped there and is being removed from that proposal.

            Assignee:
            Charlie Swanson
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: