Closed johanhaleby closed 4 years ago
När den är pipe är färdig, byt till att starta subscriptionen från globalPosition (A), försök eventuellt att filtrera bort duplicates.
Alt
db.oplog.rs.find({}).limit(1)
) betyder att det är första write i db! Isf vet vi att allt finns i oplog och behöver inte göra query!Alt 2.
Om man får reda på vilket exception som händer när oplog är full så kan man använda det för att veta att man ska läsa från db:n istället.
Doesn't seem like one has access to database "local" on e.g. Atlas so we can't use the oplog.rs to get the latest oplog :/
This means that we probably have to always use EventStoreQueries
API to catch-up. We can first read the "globalSubscriptionPosition" and stream from the EventStoreQueries
API until time <= bsontimestamp of globalSubscriptionPosition.
Fixed
I.e. a new util that would wrap a subscription to allow supplying something like "StartAt.date(new Date(..))". This utility should automatically use the
EventStoreQueries
API to read all events up to theglobalSubscriptionPosition
ifDate(..)
is too long back and not found in the oplog.