I am trying to figure out the exact content of continuous _changes feed and am confused with the result rows with seq like “1999::2999”. Would someone know to explain why at times we have this :: notation instead of just single integer, like “1999”?
My understanding this far is that in the example above “1999::2999” means “late arriving sequence” which is sort of pre-notified here, but will appear on the _changes feed later also as seq “2999”?
It’s an obscure implementation detail; nothing a client should need to care about. As a client, just treat sequence IDs as opaque JSON objects and don’t interpret their contents. (For example, Cloudant and BigCouch sequence IDs are long strings of base64.)
I am trying to keep up with the changes feed in custom listener and it is now unclear how to store the latest seen seq.
Normally I store the seq from each changefeed item as latest seq and use it in _changes POST since-parameter.
EDIT –> This part was not correct… it was due to mistake in our code. SG seems to work as expected.
But, when the seq takes format “integer1::integer2”, the _changes since-parameter does not work correctly anymore. I am expecting it to give me changes starting after “integer1::integer2”, but what it does actually, it starts after “integer1”. So practically it rewinds back a lot…
My workaround now is to store the latest seq value by taking the split("::")[1] of the :: -notation. That seems to work correctly.
<–
Please don’t parse or modify the sequence IDs! As I said, you must treat them as opaque. The format or the interpretation could change at any time, which could break your code.
In some edge cases we might end up re-sending existing changes. I’m not involved in Sync Gateway development anymore, but I know there are some very tricky scenarios when users gain/lose access to channels or docs. It may not be feasible for SG to handle them all perfectly and avoid duplication. (@adamf, @andy, any comments on this?)
Investigating more on this: If our changefeed listener has last seq “11112::12345” for example, and then the SG is restarted, the since=“11112::12345” does not work anymore. I have to test more, but I assume that since=“12345” would give the right starting point work after the SG restart.
If we don’t restart SG in the middle of operation, everything seems to work fine now.