Skip to content

Initial implementation of per-key-TTL for KV#703

Merged
mtmk merged 6 commits into
nats-io:server-2.11-featuresfrom
stebet:message-ttl
Feb 7, 2025
Merged

Initial implementation of per-key-TTL for KV#703
mtmk merged 6 commits into
nats-io:server-2.11-featuresfrom
stebet:message-ttl

Conversation

@stebet

@stebet stebet commented Jan 7, 2025

Copy link
Copy Markdown
Collaborator

Note

  • Adds support to set the AllowMsgTTL flag for KV streams
  • Adds a Timestamp ttl optional parameter to the PutAsync<T> method on INatsKVStore
    • Note that this does break API backwards compatibility if users are using their own serializers, but that's seems to be how it's done in Go client, so it's up to you if you want to create a separate overload for each method that can accept a TTL value
  • Added a single test to test the TTL functionality. This currently requires the tests to have access to the latest nightly binary

TODO:

  • More exhaustive tests
  • Add support to the CreateAsync/UpdateAsync API methods

see also ADR-43

@stebet
stebet requested a review from mtmk January 7, 2025 15:55
@stebet
stebet force-pushed the message-ttl branch 3 times, most recently from 74d3cf9 to d234060 Compare January 8, 2025 16:15
@mtmk mtmk added this to the server 2.11 milestone Jan 27, 2025
@mtmk
mtmk changed the base branch from main to server-2.11-features February 3, 2025 09:06
@mtmk

mtmk commented Feb 4, 2025

Copy link
Copy Markdown
Member

we're hoping to merge this into server 2.11 branch before server release #733

@jodydonetti

Copy link
Copy Markdown

Can't wait for per-key TTL, it will allow usage of NATS in FusionCache too.

Thanks for all the hard work!

…ts. Those implementing the interface will still need to make changes.
@stebet
stebet marked this pull request as ready for review February 6, 2025 16:40

@mtmk mtmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @stebet

There are still details to be worked out e.g. around SubjectDeleteMarkerTTL but this PR introduces support for per-message/key TTL feature for new server 2.11 soon to be released. We can have follow up PRs into the server-2.11-features branch when we have more implementation details available.

@mtmk
mtmk merged commit f053bde into nats-io:server-2.11-features Feb 7, 2025
mtmk added a commit that referenced this pull request Feb 27, 2025
* Initial implementation of per-key-TTL for KV (#703)
@mtmk mtmk mentioned this pull request Feb 27, 2025
mtmk added a commit that referenced this pull request Feb 27, 2025
* Initial implementation of per-key-TTL for KV (#703)
mtmk added a commit that referenced this pull request Apr 25, 2025
* Update README.md

* Initial implementation of per-key-TTL for KV (#703)

* Initial implementation of per-key-TTL for KV

* Skip TTL tests for nats versions older than 2.11

* Adding support for SubjectDeleteMarkerTTL in the Stream config. Added tests for errors when message TTL is disabled

* Fixing tests after rebase

* Updating the interface to not break backwards-compatibility for clients. Those implementing the interface will still need to make changes.

* Add NATS v2.11 requirement notes for TTL-related features (#751)

Updated XML comments and remarks to specify that TTL and delete marker features require NATS server v2.11 or later. This ensures clarity on version-specific functionality for developers.

* Enable workflows for release/* branches

This change updates the GitHub Actions release workflow to trigger on pushes to branches matching the release/* pattern. This ensures release-specific branches are included in the automation process.

* Release 2.6.0-preview.1 (#753)

* Initial implementation of per-key-TTL for KV (#703)

* Add priority group options (overflow) (#743)

* Add priority group options

* Add support for priority groups in pull consumers

This commit introduces priority group configuration for JetStream pull consumers. Implements behavior for `NextAsync`, `FetchAsync`, and `ConsumeAsync` with priority group settings. Unsupported cases like multiple groups and certain priority policies are handled with exceptions.

* Fix format

* Release 2.6.0-preview.2 (#754)

* Add priority group options (overflow) (#743)

* Release 2.6.0-preview.3 (#775)

Merge from main 2.5.10.

* Add KV marker reason check (#787)

* Add KV marker reason check

* Add KV watcher support for marker reason

* Add test for SubjectDeleteMarkerTTL

* Release 2.6.0-preview.4 (#816)

* Add KV marker reason check (#787)

* Fix tests

* Update KV per key TTL (#831)

* Update KV per key TTL

Based on adr-48

* Fix format

* Release 2.6.0-preview.5 (#838)

* Update KV per key TTL (#831)

---------

Co-authored-by: Stefán Jökull Sigurðarson <stefanjokull@hotmail.com>
mtmk added a commit that referenced this pull request Apr 25, 2025
* Use TimeSpan for backoff consumer config (#772)
* Update KV per key TTL (#831)
* Initial implementation of per-key-TTL for KV (#703)
* Add inflight to JS API stats model (#836)
@mtmk mtmk mentioned this pull request Apr 25, 2025
mtmk added a commit that referenced this pull request Apr 25, 2025
* Use TimeSpan for backoff consumer config (#772)
* Update KV per key TTL (#831)
* Initial implementation of per-key-TTL for KV (#703)
* Add inflight to JS API stats model (#836)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants