Skip to content

Commit

Permalink
Document consistency guarantees
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Oct 16, 2023
1 parent 35bb50d commit afbc60b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions adr/ADR-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
|----------|------------|-------------------------------------------|
| 1 | 2023-10-16 | Document NATS Server 2.10 sourced buckets |
| 1 | 2023-10-16 | Document read replica mirrors buckets |
| 1 | 2023-10-16 | Document consistency guarantees |


## Context
Expand Down Expand Up @@ -217,6 +218,16 @@ later.

The features to support KV is in NATS Server 2.6.0.

#### Consistency Guarantees

By default, we do not provide read-after-write consistency. Reads are performed directly to any replica, including out
of date ones. If those replicas do not catch up multiple reads of the same key can give different values between
reads. If the cluster is healthy and performing well most reads would result in consistent values, but this should not
be relied on to be true.

If `allow_direct` is disabled on a bucket configuration read-after-write consistency is achieved at the expense of
performance. It is then also not possible to use the mirror based read replicas.

#### Buckets

A bucket is a Stream with these properties:
Expand Down Expand Up @@ -452,6 +463,8 @@ As mirrors support subject filters these regional replicas can hold region speci
As this is a `Mirror` this stream does not listen on a subject and so the only way to get data into it is via the origin
bucket.

Watchers will always run on the original stream.

While it appears that there is significant overlap between this config and the source based one, only this strategy
creates RTT aware automatic nearest replica selection. Replicas can be added and removed without clients requiring any
knowledge of these replicas and clients will automatically use the nearest replica. During the life of a client the
Expand Down

0 comments on commit afbc60b

Please sign in to comment.