Skip to content

Commit

Permalink
Process replicated ack regardless of store update. Delay but still st…
Browse files Browse the repository at this point in the history
…epdown

Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Apr 2, 2023
1 parent 6698df3 commit 9ae5196
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions server/jetstream_cluster.go
Expand Up @@ -4525,11 +4525,9 @@ func (o *consumer) processReplicatedAck(dseq, sseq uint64) {

// Update activity.
o.lat = time.Now()

// Do actual ack update to store.
if err := o.store.UpdateAcks(dseq, sseq); err != nil {
o.mu.Unlock()
return
}
o.store.UpdateAcks(dseq, sseq)

if o.retention == LimitsPolicy {
o.mu.Unlock()
Expand Down
1 change: 1 addition & 0 deletions server/raft.go
Expand Up @@ -1352,6 +1352,7 @@ func (n *raft) StepDown(preferred ...string) error {
if maybeLeader != noLeader {
n.debug("Selected %q for new leader", maybeLeader)
prop.push(&Entry{EntryLeaderTransfer, []byte(maybeLeader)})
time.AfterFunc(250*time.Millisecond, func() { stepdown.push(noLeader) })
} else {
// Force us to stepdown here.
n.debug("Stepping down")
Expand Down

0 comments on commit 9ae5196

Please sign in to comment.