From 83a8d181ef785f33f26d70cc6b98df6a0e83e03d Mon Sep 17 00:00:00 2001 From: Alex Bozhenko Date: Thu, 30 Oct 2025 09:34:46 -0700 Subject: [PATCH] add unreachable assert about legacy snapshot unmarshalling Signed-off-by: Alex Bozhenko --- server/jetstream_cluster.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/jetstream_cluster.go b/server/jetstream_cluster.go index a40e9590cd1..d58029559a4 100644 --- a/server/jetstream_cluster.go +++ b/server/jetstream_cluster.go @@ -3490,6 +3490,14 @@ func (js *jetStream) applyStreamEntries(mset *stream, ce *CommittedEntry, isReco return 0, err } } else { + // Older v1 version with deleted as a sorted []uint64. + // For a stream with millions or billions of interior deletes, this will be huge. + // Now that all server versions 2.10.+ support binary snapshots, we should never fall back. + assert.Unreachable("Legacy JSON stream snapshot unmarshalled", map[string]any{ + "stream": mset.cfg.Name, + "account": mset.acc.Name, + }) + var snap streamSnapshot if err := json.Unmarshal(e.Data, &snap); err != nil { onBadState(err) @@ -8751,7 +8759,8 @@ func (mset *stream) supportsBinarySnapshotLocked() bool { } // StreamSnapshot is used for snapshotting and out of band catch up in clustered mode. -// Legacy, replace with binary stream snapshots. +// +// Deprecated: replaced with binary stream snapshots. type streamSnapshot struct { Msgs uint64 `json:"messages"` Bytes uint64 `json:"bytes"`