Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-445

ChangeStream::next() should not increment key if ResumeTokenException is thrown

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.5.0
    • Labels:
      None

      Description

      The current behavior was previously introduced in PHPLIB-335 in 1.3.1, shortly after the introduction of change streams in 1.3.0. While I originally request that change, I'm no longer sure that it makes sense.

      In the event of a ResumeTokenException, no document is being returned to the user so there seems little value in incrementing the change stream key. The key itself has no direct relation to the underlying cursor and is merely a sequence for each event document returned during iteration. It seems sensible to only increment it when next() does return a document successfully. That would also be consistent with behavior when an exception is thrown by iterating the underlying cursor (i.e. call to next() on the internal iterator decorating the cursor), as the key is not advanced in that case.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jmikola Jeremy Mikola
              Reporter:
              jmikola Jeremy Mikola
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: