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

[FIXED] Data races detected in internal testing #4211

Merged
merged 1 commit into from Jun 3, 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
5 changes: 4 additions & 1 deletion server/jetstream_cluster.go
Expand Up @@ -3400,6 +3400,7 @@ func (js *jetStream) processClusterCreateStream(acc *Account, sa *streamAssignme
s, rg := js.srv, sa.Group
alreadyRunning := rg.node != nil
storage := sa.Config.Storage
restore := sa.Restore
js.mu.RUnlock()

// Process the raft group and make sure it's running if needed.
Expand All @@ -3408,11 +3409,13 @@ func (js *jetStream) processClusterCreateStream(acc *Account, sa *streamAssignme
// If we are restoring, create the stream if we are R>1 and not the preferred who handles the
// receipt of the snapshot itself.
shouldCreate := true
if sa.Restore != nil {
if restore != nil {
if len(rg.Peers) == 1 || rg.node != nil && rg.node.ID() == rg.Preferred {
shouldCreate = false
} else {
js.mu.Lock()
sa.Restore = nil
js.mu.Unlock()
}
}

Expand Down
2 changes: 2 additions & 0 deletions server/raft.go
Expand Up @@ -1816,9 +1816,11 @@ func (n *raft) runAsFollower() {
} else if n.isCatchingUp() {
n.debug("Not switching to candidate, catching up")
// Check to see if our catchup has stalled.
n.Lock()
if n.catchupStalled() {
n.cancelCatchup()
}
n.Unlock()
} else {
n.switchToCandidate()
return
Expand Down
4 changes: 3 additions & 1 deletion server/stream.go
Expand Up @@ -4490,7 +4490,9 @@ func (mset *stream) resetAndWaitOnConsumers() {
}
node.Delete()
}
o.monitorWg.Wait()
if o.isMonitorRunning() {
o.monitorWg.Wait()
}
}
}

Expand Down