Better explain what we mean by 'changes' in durable state queries
octonato opened this issue · 0 comments
As suggested by @pawelkaczor in
f3942ec#r59589841
To shortly describe that we mean by 'changes':
Durable state replaces the previous state each time and it's not cumulative as in append-only event journal.
When querying for the changes, the user gets all states that have been updated after a given offset.
If in time 1 we have:
id | offset | state |
123 | 1 | abc |
456 | 2 | def |
If we request the changes starting from offset 1, we will get (123, 1, "abc")
and (456, 2, "def")
If we update 123, to 'aabbcc', we will have:
id | offset | state |
456 | 2 | def |
123 | 3 | aabbcc |
Update it once again to 'abcabc' and we will have:
id | offset | state |
456 | 2 | def |
123 | 4 | abcabc |
If we run the same query (assuming that we pass offset 1 as param. ), we will have: (456, 2, "def")
and (123, 4, "abcabc")
.
Note that offset 1 and 3 are gone as well as its state. In the case of offset 3, its state is never delivered since no intermediate query was issued.
So basically the query returns the latest known state for each record with an offset equal or greater than the offset param.