-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
When originally implementing the change stream spec test runner, I iterated the change stream using iterator_to_array(). This would normally be OK for the purposes of the spec test, since the runner opens a change stream, perform all operations in sequence, and finally iterates the change stream to collected events for those operations. As there is no need to watch the change stream for future events, it's acceptable that iterator_to_array() stops when valid() returns false (i.e. no more events available).
The default behavior of iterator_to_array() preserves keys from the iterator. In the test where the change stream resumes after a getMore failure, this results in the original event (returned by aggregate) being overwritten. Since a ChangeStream only replaces its inner iterator when resuming, I don't believe this is caused by the $key property being reset (the ChangeStream instance remains the same). Rather, I think the issue is that we're not incrementing $key properly.
Although we can work around this by the $use_keys option for iterator_to_array(), it is hardly intuitive and it'd be preferable to fix the increment behavior.
- is depended on by
-
PHPLIB-416 Ensure that getMore right after a resume is retried
- Closed
- is related to
-
PHPLIB-442 ChangeStream does not update resume token after resuming
- Closed
-
PHPLIB-440 Document behavior of using iterator_to_array() with a ChangeStream
- Backlog
-
PHPLIB-366 Implement test runner for change stream spec tests
- Closed
- related to
-
PHPLIB-454 Fix test failures when startAtOperationTime is unsupported
- Closed