Strategies for finding updated entries in an eventually consistent database

77 Views Asked by At

If I have a bunch of entries stored in an eventually consistent database, are there any standard strategies for how I go about reliably finding modified entries? Of course they will only be found "eventually", which is ok, but I'd like to avoid possible scenarios in which they will never be found.

This seems like an issue that should be extremely prevalent and therefore I would expect there to be some standard ways of handling it. But unfortunately I'm having quite a hard time finding anything useful about it.

The approach I've been thinking about is to tag all entries with some sort of monotonically increasing version number (e.g. a timestamp) and then querying the database for all entries with a version number larger than the highest one I've seen so far. The problem with this is that entries might be committed (and thus returned in the query) out of order. So, if a later update "makes it" into a given query and an earlier one doesn't, I can't just use the later one's version number as the highest I've seen so far in the next query, otherwise I will never find the earlier update.

If the version numbers could be guaranteed to be always increasing continuously with no skipped versions (which is difficult to achieve in my case, but might be doable), I could simply keep around a change log with one entry for each change and then query for "give me all versions except x, y, z, ...". But this change log and the associated queries would potentially be huge (depending on the speed at which changes come in relative to the time-scale over which I can assume consistency), so I don't think this would be a good option.

Any thoughts?

0

There are 0 best solutions below