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 warn if error is node closed. #3968

Merged
merged 2 commits into from Mar 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions server/jetstream_cluster_3_test.go
Expand Up @@ -2958,6 +2958,7 @@ func TestJetStreamClusterWorkQueueConsumerReplicatedAfterScaleUp(t *testing.T) {

require_True(t, ci.Config.Replicas == 0 || ci.Config.Replicas == 3)

c.waitOnConsumerLeader(globalAccountName, "TEST", ci.Name)
s := c.consumerLeader(globalAccountName, "TEST", ci.Name)
require_NotNil(t, s)

Expand Down
8 changes: 6 additions & 2 deletions server/raft.go
Expand Up @@ -2507,6 +2507,10 @@ func (n *raft) applyCommit(index uint64) error {
// Used to track a success response and apply entries.
func (n *raft) trackResponse(ar *appendEntryResponse) {
n.Lock()
if n.state == Closed {
n.Unlock()
return
}

// Update peer's last index.
if ps := n.peers[ar.peer]; ps != nil && ar.index > ps.li {
Expand All @@ -2532,8 +2536,8 @@ func (n *raft) trackResponse(ar *appendEntryResponse) {
if nr := len(results); nr >= n.qn {
// We have a quorum.
for index := n.commit + 1; index <= ar.index; index++ {
if err := n.applyCommit(index); err != nil {
n.error("Got an error apply commit for %d: %v", index, err)
if err := n.applyCommit(index); err != nil && err != errNodeClosed {
n.error("Got an error applying commit for %d: %v", index, err)
break
}
}
Expand Down