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

Added DuplicateWindow to NatsKVConfig #440

Closed
wants to merge 2 commits into from

Conversation

darkwatchuk
Copy link
Contributor

@darkwatchuk darkwatchuk commented Mar 11, 2024

The DuplicateWindow TimeSpan needs to be exposed for KVStores in order to facilitate certain patterns like leader election within a reasonable time period. Currently it's fixed at 2 minutes, so you can't reduce MaxAge to less than this.

This PR just exposes DuplicateWindow via NatsKVConfig as an optional parameter with the default left at the current 2 minutes.

@darkwatchuk darkwatchuk changed the title Added DuplicateWinfo to NatsKVConfig Added DuplicateWindow to NatsKVConfig Mar 11, 2024
@mtmk
Copy link
Collaborator

mtmk commented Mar 11, 2024

this might potentially be a contentious change and not inline with the spec. @ripienaar is this acceptable?

@darkwatchuk
Copy link
Contributor Author

Vid here, show the TTL. https://youtu.be/XLJ5_5MsgGQ?t=1763 , But using just using MaxAge in the .net v2, causes the following :
image

@ripienaar
Copy link

Duplicate window should == MaxAge when MaxAge is below 2 minutes.

https://github.com/nats-io/nats.go/blob/52a2d33b791b6e819aacdaeef2c0b79c2cfbf81b/jetstream/kv.go#L573

…nt to automatically reduce the duplicate window
@mtmk
Copy link
Collaborator

mtmk commented Mar 11, 2024

thanks @ripienaar

So, it looks like we just need to implement the validation but there is not reason why you can't make the duplicate window configurable.

OK just realised we did have a related change in #362. Just merged that, so you need to fix conflicts, sorry about that.

@darkwatchuk
Copy link
Contributor Author

Have mimicked the Go Client. Go client options don't allow you to configure the duplicate window. It just sets duplicate window to max age if max age is < 2 mins....

@mtmk
Copy link
Collaborator

mtmk commented Mar 11, 2024

@darkwatchuk I thought you also wanted to make duplicate window configurable, no?

edit: if not this was already fixed in #362 (just merged)

@ripienaar
Copy link

I'd prefer not to make it configurable - we dont want to over expose stream internals

@darkwatchuk
Copy link
Contributor Author

@darkwatchuk I thought you also wanted to make duplicate window configurable, no?

No. I just needed a MaxAge < 2 mins. The only way to do this was reduce the window. Am happy with the Go client implementation of auto setting both to be the same.

@darkwatchuk
Copy link
Contributor Author

Ok - fine if just merged. I'll close this.

@mtmk
Copy link
Collaborator

mtmk commented Mar 11, 2024

Ok - fine if just merged. I'll close this.

sorry about the confusion. thanks @darkwatchuk

@darkwatchuk darkwatchuk deleted the Add-TTL-to-KV branch March 11, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants