nats-io / nats-architecture-and-design

Architecture and Design Docs
Apache License 2.0
187 stars 20 forks source link

KV Discard policy #103

Open kozlovic opened 2 years ago

kozlovic commented 2 years ago

Overview

The discard policy should be set to "new", but really for server 2.7.2+ since only this server handles discard policy "new" correctly for KV use-case, that is with "max msgs per subject" set: this will prevent new "keys" to be added, but discard old for a given "key" allowing KV delete/purge (adding tombstone) to be added on a given "key" (subject).

The Go client has implemented a change that updates the stream's discard policy if connecting to a v2.7.2+ and find that the stream exists with discard policy "old": https://github.com/nats-io/nats.go/pull/917

The behavior is documented in ADR-8.

Clients and Tools

Other Tasks

Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.