Change stream resumability with startAtOperationTime

Hello,

I have a question regarding the behavior of startAtOperationTime. According to the documentation startAtOperationTime only works if you provide a timestamp within the time range of the oplog. The behavior I experience is different. Here’s how I create a timestamp and pass it to the change stream using the official rust driver.

let start_time = Timestamp { time: 0, increment: 0 };
let opts = ChangeStreamOptions::builder().start_at_operation_time(Some(start_time)).build();

And here’s part of the output of rs.printReplicationInfo()

oplog first event time
'Sun Oct 22 2023 16:52:07 GMT+0300 (Eastern European Summer Time)'

Clearly the provided timestamp is outside the oplog time window, yet the stream starts without issues from the oldest entry in the oplog. This link is from Stack Overflow showing that other people experience the same thing using the java driver, which makes me think it is not a driver specific problem.

The described behavior suits me right, but considering it contradicts the documentation, I would like to know if it is intentional and I can rely on it, or it might be changed in future releases.

Regards,
Pavel

Maybe mongodb treats 0 + 0 as a special value? try some other values?

Thanks for the suggestion, Kobe, but it doesn’t make a difference when the time stamp is other than (0, 0). I am starting to think that this is the expected behavior and the documentation is simply poorly worded.

Definitely possible. Mongodb is a big system with a lot of features. Keeping the doc fully update (and correct) is challenging. That’s also why many documentation websites have feedback links.

So does this one.

2 Likes

Thanks for the screenshot, Chris. I will try submit feedback that way. I believe the assumption that startAtOperationTime should work with timestamps outside the oplog’s time window is correct. Of course if someone thinks otherwise feel free to correct me.