allthingssecurity commented on PR #30136: URL: https://github.com/apache/camel/pull/30136#issuecomment-6911931738
Thanks for checking it against the driver, Claus. Pushed 36a39fbd10f6. 1. **[Question] Other errors of `startAtOperationTime`:** yes. BadValue (2), FailedToParse (9) and 40415 (unknown field of the `$changeStream` stage) now count as "the server does not accept the option": the consumer logs a WARN, opens the change stream at the current time as main does, and stops trying `startAtOperationTime` for the rest of its life, so it does not send the extra `ping` or log the WARN on every reopen. Any other `MongoCommandException` is still rethrown and retried after the regeneration delay, as a transient error should be. I did not add a count of consecutive failures: with the codes above the only loop left is the one main already has for a failing aggregate. New test `startAtOperationTimeRefusedStartsAtTheCurrentTimeAndIsNotTriedAgain` (40415, checks that only the first change stream sends the `ping`). 2. **[Question] ChangeStreamHistoryLost on the first getMore:** I could not confirm it against a server here (no Docker). As far as I can tell the server checks the start when the aggregate builds its first batch, but rather than depend on that, `doRun` now handles it too: a 286, 280 or 40576 from the cursor of a change stream opened without a token, while the start time is set, gives the same WARN and clears the start time, so the next cursor opens at the current time instead of looping on the old start at debug. New test `startNoLongerInTheOplogFoundByTheFirstGetMoreStartsAtTheCurrentTime` (the aggregate accepts the start, the first `hasNext` fails with 286). 3. **[Suggestion] An IT against the test-infra MongoDB:** not added. I cannot run the ITs here (they need Docker), and I would rather not push an IT I have not run once. I'm happy to add it as a follow-up (ping with the collection's read preference, insert, then `watch().startAtOperationTime(opTime + 1)` sees the insert), if you want it in this PR or as a separate one. 4. **[Suggestion] Shared helper:** taken. New package-private `MongoDbChangeStreamsMocks` with the database mock (collection `events`), a change stream mock that keeps its resume options (`resumeAfter`, `startAfter`, `startAtOperationTime`) and hands them to the test's `open` function, a cursor over a list of events, a change event, and the error reply of a command. `MongoDbChangeStreamsReopenTest` and `MongoDbChangeStreamsInvalidateTest` both use it now; each keeps only its own server behaviour. On `strictFirstCursor` as the world's default: as you say, whichever of this PR and #30135 merges second will carry it. Tests: the camel-mongodb unit tests pass (36 run, 0 failures), with 8 in `MongoDbChangeStreamsReopenTest` and 2 in `MongoDbChangeStreamsInvalidateTest`. _Claude Code on behalf of allthingssecurity_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
