Enable binary snapshots on initial route connections#7476
Closed
alexbozhenko wants to merge 2 commits intomainfrom
Closed
Enable binary snapshots on initial route connections#7476alexbozhenko wants to merge 2 commits intomainfrom
alexbozhenko wants to merge 2 commits intomainfrom
Conversation
Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
b1ece18 to
572e341
Compare
alexbozhenko
commented
Oct 28, 2025
| stats: nil, | ||
| offline: false, | ||
| js: info.JetStream, | ||
| binarySnapshots: true, |
Member
Author
There was a problem hiding this comment.
This was initially added here:
https://github.com/nats-io/nats-server/pull/4284/files#diff-e02d4430ca4d47be9db1b632ddb92d22c34c0919348bc020ce809e64fca8631cR2000
This is kinda hard to read and easy to mess up a struct with bunch of values of similar type.
Maybe add this linter?
https://golangci-lint.run/docs/linters/configuration/#exhaustruct
Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
neilalexander
added a commit
that referenced
this pull request
Oct 28, 2025
When routes to other servers are established `binarySnapshots` is initially set to `false` indicating it is not supported. Then once a `STATSZ` is received `binarySnapshots` will be updated to `true`. Whether this server supports binary snapshots is determined by looping over the peers and checking if other servers don't support it: ``` if sir, ok := s.nodeToInfo.Load(p.ID); ok && sir != nil && !sir.(nodeInfo).binarySnapshots ``` However, there's an issue here as the server will shortly think `binarySnapshots` isn't supported and go back to the legacy snapshot which contains interior deletes as a `[]uint64` which will be disastrous if a stream has a huge amount of interior deletes. Since binary stream snapshots are supported since 2.10.0, we can simply flip the `binarySnapshots` default from `false` to `true`. Alternative to #7476 Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Alex Bozhenko alexbozhenko@gmail.com