Skip to content
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

Nats discard policy "new" #7231

Closed
case0sh opened this issue Sep 6, 2023 · 5 comments
Closed

Nats discard policy "new" #7231

case0sh opened this issue Sep 6, 2023 · 5 comments
Labels

Comments

@case0sh
Copy link
Contributor

case0sh commented Sep 6, 2023

Describe the bug

The oCIS nats store does create streams with discard policy "new"

~ # nats s info OBJ_eventhistory
Information for Stream OBJ_eventhistory created 2023-09-06 08:20:09

          Description: Object storage administered by go-micro store plugin
             Subjects: $O.eventhistory.C.>, $O.eventhistory.M.>
             Replicas: 1
              Storage: File

Options:

            Retention: Limits
     Acknowledgements: true
       Discard Policy: New
     Duplicate Window: 2m0s
           Direct Get: true
    Allows Msg Delete: true
         Allows Purge: true
       Allows Rollups: true

Limits:

     Maximum Messages: unlimited
  Maximum Per Subject: unlimited
        Maximum Bytes: unlimited
          Maximum Age: 14d0h0m0s
 Maximum Message Size: unlimited
    Maximum Consumers: unlimited


Cluster Information:

                 Name: nats
               Leader: nats-2

State:

             Messages: 36
                Bytes: 24 KiB
             FirstSeq: 1 @ 2023-09-06T08:20:09 UTC
              LastSeq: 36 @ 2023-09-06T08:22:14 UTC
     Active Consumers: 0
   Number of Subjects: 36

This currently does not have any bad effect because oCIS is not setting limits on a stream, but if somebody enforces limits policy "new" might not be what we want

Steps to reproduce

Steps to reproduce the behavior:

  1. start oCIS with external Nats
  2. Inspect the stream for the oCIS store

Expected behavior

Discard policy should be "old"

Actual behavior

Discard policy is "new"

Setup

I was using the ocis-nats deployment example for k8s.

@wkloucek
Copy link
Contributor

Discard Policy is actually expected to be set to "new" for stores. If the store is "full" it should reject new entries and error

@wkloucek
Copy link
Contributor

will be supersed if #7272 is implemented

@wkloucek
Copy link
Contributor

Caches should have Discard Policy "old"

eg storage-users don't have it yet:

~ # nats stream info KV_storage-users
Information for Stream KV_storage-users created 2024-01-23 11:39:16

           Description: KeyValue storage administered by go-micro store plugin
              Subjects: $KV.storage-users.>
              Replicas: 1
               Storage: Memory

Options:

             Retention: Limits
       Acknowledgments: true
        Discard Policy: New

@kobergj
Copy link
Collaborator

kobergj commented Jan 25, 2024

I'm afraid changing the discard policy is not possible. According to https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md#buckets a KeyValue store is a stream where

Discard Policy is always set to new

@micbar
Copy link
Contributor

micbar commented Jan 26, 2024

See above.

@micbar micbar closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants