From afbc60b071b030b60f1f62225a3428b521d2413f Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Mon, 16 Oct 2023 17:44:33 +0200 Subject: [PATCH] Document consistency guarantees Signed-off-by: R.I.Pienaar --- adr/ADR-8.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/adr/ADR-8.md b/adr/ADR-8.md index 5f9d544e..3f6046e0 100644 --- a/adr/ADR-8.md +++ b/adr/ADR-8.md @@ -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 @@ -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: @@ -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