`oplogIncludeCollections` option breaks oplog tailing performance
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 44.8k
- Forks
- 5.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
The `oplogIncludeCollections` option for oplog tailing introduced in 2.16.0 seems very useful for us as most database updates are made to collections we don't subscribe to. Unfortunately, adding the option made our application stop working when the oplog contains sufficiently many entries (~30M does the trick).
This seems to be because the option changes the query to just a [top-level `$and`](https://github.com/meteor/meteor/blob/7da5b32d7882b510df8aa2002f891fc4e1ae1126/packages/mongo/oplog_tailing.js#L286). However, this means there is no top-level `ts` property on the selector, which means that [the `oplogReplay` flag is not set](https://github.com/meteor/meteor/blob/7da5b32d7882b510df8aa2002f891fc4e1ae1126/packages/mongo/mongo_driver.js#L1028).
Moving the `ts` selector outside of the `$and` fixes the problem.
Haven't tested with Meteor 3 yet, but as the code is unchanged (above links are to the latest revision), I assume the problem still exists.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/mongo/oplog_tailing.js at the linked selector construction, then trace packages/mongo/mongo_driver.js at the linked oplogReplay check. Reproduce the problem with an oplog containing roughly 30M entries and oplogIncludeCollections enabled. Done means collection filtering no longer prevents the intended oplog-tailing performance behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100