monstache icon indicating copy to clipboard operation
monstache copied to clipboard

monstache save timestamp not as expected when use change stream watching multiple collections

Open neilchen12 opened this issue 2 years ago • 2 comments

Hi rwynn.

when set change-stream-namespaces = ["db.member", "db.product"] and resume = true, If the synchronization of the member collection has a long delay(product collection is normal), if i insert one doc in product collection and the monstache save the timestamp in monstache collection, now timestamp recorded in the monstache collection is newer than member collection in oplog, this causes that the timestamp in the montache collection cannot be update when synchronizing the member collection oplog until the oplog timestamp is newer than the timestamp recorded in the montache collection(ic.hasNewEvents == false).

Is this expected behavior or is there something wrong with my configuration? Please help @rwynn

neilchen12 avatar Sep 19 '22 16:09 neilchen12

Hi @neilchen12 Would you be able to try a different resume strategy? There is another that saves a separate resume token per change stream (per collection in your case) instead of a single timestamp. You can enable using

resume-strategy=1

https://rwynn.github.io/monstache-site/config/#resume-strategy

rwynn avatar Sep 22 '22 01:09 rwynn

@rwynn thank you for your reply.

I tried resume token and it works, but sometimes i need to resume from a specified timestamp by resume-from-timestamp config( or directly modify the ts in the monstache collection), when use resume token, how should i do? the token._data doesn't seem to be modifiable.

neilchen12 avatar Sep 22 '22 06:09 neilchen12