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

Rewinding change stream cursor should never execute a getMore command

    XMLWordPrintable

    Details

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

      Description

      ChangeStream::resume() should not rewind the cursor if the resuming aggregate command returns an empty firstBatch. Doing so will execute an additional getMore command from within resume().

      Apart from resuming, this is also a problem for ChangeStream::rewind(). If the change stream cursor's initial batch is empty, calling ChangeStream::rewind() will also execute a getMore command.

      If aggregate does return a non-empty firstBatch, it is safe to rewind as that will merely advance the cursor to the first result (entirely a client-side operation). That is desirable behavior, as resuming should leave the change stream iterator's position at the next element if possible.

      See: this comment in PHPLIB-416.

        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: