Skip to content

Conversation

@timvaillancourt
Copy link
Contributor

@timvaillancourt timvaillancourt commented Jul 9, 2018

When we do not have a known last timestamp in the oplog tailer we use the func .BsonTimestampNow() to find a place in the oplog. "now" isn't a very useful place to start tailing from, at least in this use case.

This PR moves to doing a .Find() query to find the "tail" timestamp of the oplog. When we do not have a known place to start tailing this will cause the code to start at the oldest/tail point in the oplog. This will guarantee we have all the data better than using "now".

If the .Find() query fails we fallback to bson.MongoTimestamp(0) which should equal the epoch (January 1970?), which will still work in the .Find() as a good fallback - the "ts" index will still do a $gt/$gte on this fine.

@percona-csalguero: feel free to propose any style changes, thoughts, etc.

@percona-csalguero percona-csalguero merged commit d502874 into master Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants