CursorEstablisher returns retry cancellation over original failure

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      CursorEstablisher has some logic to decide which failure to return in the event that it sends multiple requests that fail with distinct errors. It appears that it is possible for it to prefer an error that is received when a sleep associated with a retry backoff is cancelled, possibly as a result of the original error.

      As an example, this can be encountered with the following sequence:

      • CursorEstablisher sends two requests
      • First request is rejected by the shard's rate limiter, inducing a backoff sleep
      • Second request fails with a CollectionUUIDMismatch error
      • First request is cancelled via stopRetrying, yielding a CallbackCanceled error ("Baton wait canceled")
      • Final error returned is CallbackCanceled, instead of CollectionUUIDMismatch

      We should update CursorEstablisher's error handling logic to ensure that the original error is not lost in these situations.

      https://github.com/mongodb/mongo/blob/ab099727112ab36c8972c47d12145ce4e3462b11/src/mongo/s/query/exec/establish_cursors.cpp#L380

            Assignee:
            Unassigned
            Reporter:
            Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: