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

Don't include unnecessary ClientInfo fields in metalayer snapshots #6185

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions server/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@ type ClientInfo struct {
Nonce string `json:"nonce,omitempty"`
}

// forAssignmentSnap returns the minimum amount of ClientInfo we need for assignment snapshots.
func (ci *ClientInfo) forAssignmentSnap() *ClientInfo {
return &ClientInfo{
Account: ci.Account,
derekcollison marked this conversation as resolved.
Show resolved Hide resolved
Service: ci.Service,
Cluster: ci.Cluster,
}
}

// ServerStats hold various statistics that we will periodically send out.
type ServerStats struct {
Start time.Time `json:"start"`
Expand Down
6 changes: 4 additions & 2 deletions server/jetstream_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ func (js *jetStream) metaSnapshot() []byte {
for _, asa := range cc.streams {
for _, sa := range asa {
wsa := writeableStreamAssignment{
Client: sa.Client,
Client: sa.Client.forAssignmentSnap(),
Created: sa.Created,
Config: sa.Config,
Group: sa.Group,
Expand All @@ -1555,7 +1555,9 @@ func (js *jetStream) metaSnapshot() []byte {
if ca.pending {
continue
}
wsa.Consumers = append(wsa.Consumers, ca)
cca := *ca
cca.Client = cca.Client.forAssignmentSnap()
wsa.Consumers = append(wsa.Consumers, &cca)
nca++
}
streams = append(streams, wsa)
Expand Down