KeyValue Revision not unique to a key but to a bucket: Difference to a spec? #4580
Replies: 2 comments
-
Values are actually jetstream messages and the sequence is the message sequence of the stream - since the underlying stream is sequenced by message and not subject (every message in the stream needs a unique sequence) this is also how it behaves in KV. Not sure there is anything we can do about this in the short term - but ultimately this is working as designed. |
Beta Was this translation helpful? Give feedback.
-
And indeed every sequence number for subsequent values is is unique per key, just not contiguous. If you do a watch for the key in question you do get the values in order so you can number them as you receive them. |
Beta Was this translation helpful? Give feedback.
-
I've been using the KeyValue store of NATS quite heavily lately and really like it. But the revision management/revision history of a particular key is kind of a strange. This has been previously discussed here: #3466
Long story short, I initially believed that the .NET Client of NATS was doing something incorrectly after noticing that the revisions for a specific keys weren't 1, 2, 3, 4, 5 etc. as they instead are affected by the other keys in the bucket.
I checked the spec (from https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md) and it mentions that:
// Revision is a unique sequence for this value
I decided to verify the bug using NATS Cli and as it was behaving like the .NET client, I ended up in the discussion mentioned above which shows that things are working as expected.
Couple questions/clarifications:
Thanks in advance and thank you for the great project.
Beta Was this translation helpful? Give feedback.
All reactions