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

Rewinding change stream cursor should never execute a getMore command

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: