Skip to content

Commit

Permalink
Re-introduce stream/consumer snapshot on shutdown (#6279)
Browse files Browse the repository at this point in the history
Since the race condition of installing snapshots during shutdown was
fixed in #6153, we have not
re-introduced this snapshotting but done in the right place. (Meta
already has this)

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
  • Loading branch information
derekcollison authored Dec 18, 2024
2 parents e5ccb2d + 3e6592e commit 87f42d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/jetstream_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2543,10 +2543,14 @@ func (js *jetStream) monitorStream(mset *stream, sa *streamAssignment, sendSnaps
for {
select {
case <-s.quitCh:
// Server shutting down, but we might receive this before qch, so try to snapshot.
doSnapshot()
return
case <-mqch:
return
case <-qch:
// Clean signal from shutdown routine so do best effort attempt to snapshot.
doSnapshot()
return
case <-aq.ch:
var ne, nb uint64
Expand Down Expand Up @@ -4974,8 +4978,12 @@ func (js *jetStream) monitorConsumer(o *consumer, ca *consumerAssignment) {
for {
select {
case <-s.quitCh:
// Server shutting down, but we might receive this before qch, so try to snapshot.
doSnapshot(false)
return
case <-qch:
// Clean signal from shutdown routine so do best effort attempt to snapshot.
doSnapshot(false)
return
case <-aq.ch:
ces := aq.pop()
Expand Down

0 comments on commit 87f42d7

Please sign in to comment.