Skip to content

Commit

Permalink
[IMPROVED] Bumped inflight updates to 16 and move one lock to rlock. (#…
Browse files Browse the repository at this point in the history
…4621)

Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Oct 3, 2023
2 parents 21e2723 + 2d21bc7 commit 3f1afb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions server/jetstream_cluster.go
Expand Up @@ -7722,8 +7722,8 @@ func (mset *stream) isCurrent() bool {
return mset.node.Current() && !mset.catchup
}

// Maximum requests for the whole server that can be in flight.
const maxConcurrentSyncRequests = 8
// Maximum requests for the whole server that can be in flight at the same time.
const maxConcurrentSyncRequests = 16

var (
errCatchupCorruptSnapshot = errors.New("corrupt stream snapshot detected")
Expand Down Expand Up @@ -7900,11 +7900,11 @@ RETRY:

// Grab sync request again on failures.
if sreq == nil {
mset.mu.Lock()
mset.mu.RLock()
var state StreamState
mset.store.FastState(&state)
sreq = mset.calculateSyncRequest(&state, snap)
mset.mu.Unlock()
mset.mu.RUnlock()
if sreq == nil {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions server/raft.go
Expand Up @@ -654,9 +654,9 @@ func (s *Server) transferRaftLeaders() bool {
// This should only be called on the leader.
func (n *raft) Propose(data []byte) error {
n.RLock()
if n.state != Leader {
if state := n.state; state != Leader {
n.RUnlock()
n.debug("Proposal ignored, not leader (state: %v)", n.state)
n.debug("Proposal ignored, not leader (state: %v)", state)
return errNotLeader
}
// Error if we had a previous write error.
Expand Down

0 comments on commit 3f1afb4

Please sign in to comment.