- 
                Notifications
    
You must be signed in to change notification settings  - Fork 47
 
ADR-53: JetStream Read-after-Write #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fd912d8    to
    d1906d5      
    Compare
  
    d1906d5    to
    abac5bd      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general really like this approach. I did have a question on deletes.
abac5bd    to
    2848047      
    Compare
  
    f2b0011    to
    8753448      
    Compare
  
    8753448    to
    2ef9ef7      
    Compare
  
    5b42cf8    to
    96874cf      
    Compare
  
    See [ADR: JetStream Read-after-Write](nats-io/nats-architecture-and-design#358) for context, problem statement, and design. Resolves #6557 Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
96874cf    to
    13abd6f      
    Compare
  
    | 
           The server's read-after-write PR (nats-io/nats-server#6970) has been merged. Have updated this ADR's status to "Implemented". Have also included a "Client Implementation" section that outlines the support required in the clients. For reference, have created a draft Go client implementation. Please note it's incomplete, but it can be used as a reference. Have modeled that to what could be idiomatic in the Go client, other clients could improve to what's idiomatic there (the design is not strict on that).  | 
    
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
13abd6f    to
    f0aabb4      
    Compare
  
            
          
                adr/ADR-53.md
              
                Outdated
          
        
      | 
               | 
          ||
| ## Problem Statement | ||
| 
               | 
          ||
| JetStream does NOT support read-after-write or monotonic reads. This can be especially problematic when | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe say before 2.12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, dcb9074:
JetStream does NOT support read-after-write or monotonic reads (prior to server version 2.12).
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| 
           Parking this for a little bit, this feature will not be included in the upcoming 2.12 release. One idea we've discussed a little already is instead of everything being opt-in and on a per-request basis, instead make it a stream-setting. Something like  Lots to figure out still, but need some more options so we can discuss which would be preferable.  | 
    
| 
           We're very interested in this feature. Right now we're minimizing the window by leaving direct get disabled, but this would let us turn everything on. I'm curious if there's appetite for Spanner-like client-specified consistency requirements?  | 
    
          
 Thanks for sharing! Am not too familiar with Spanner myself, could you perhaps share a resource for the client-specified consistency requirements? The primary options for stronger read consistency with JetStream would be that it's either specified client-side on a per-read-request basis ("for this specific request I need reads to be linearizable, versus by default they are eventually consistent with direct get"). Or specified top-level in the stream, which would mean all reads would be linearizable if specified as such. Is this similar to what you're suggesting/expecting?  | 
    
| 
           Specifically Spanner has a "max staleness" bound: https://cloud.google.com/spanner/docs/reads#perform-stale-read Was just an idle thought, not a feature request here. :)  | 
    
          
 That's what we're looking for, definitely. We don't necessarily need to force a leader round-trip; we often have a "last seen sequence" that we need the responder to be up-to-date to.  | 
    
Up to this point JetStream has never been able to guarantee read-after-write or monotonic reads, unless the underlying stream was not replicated.
This ADR proposes a solution to both read-after-write and monotonic reads, for both Direct Get requests and consumers, that does not require all reads to go through replication.
Also clarified other ADRs that reference read-after-write.
Server PR: nats-io/nats-server#6970
Draft Go client implementation for read requests, consumers, and KV for both the old and new APIs (only object store is missing).
Resolves nats-io/nats-server#6557