Merge pull request #2034 from nats-io/memstore_locking

Calling out to the storage update should not hold lock.
This commit is contained in:
Derek Collison
2021-03-26 05:41:43 -07:00
committed by GitHub
4 changed files with 8 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ var (
const (
// VERSION is the current version for the server.
VERSION = "2.2.1-RC8"
VERSION = "2.2.1-RC9"
// PROTO is the currently supported protocol.
// 0 was the original

View File

@@ -4486,6 +4486,9 @@ func (js *jetStream) clusterInfo(rg *raftGroup) *ClusterInfo {
for _, rp := range peers {
if rp.ID != id && rg.isMember(rp.ID) {
lastSeen := now.Sub(rp.Last)
if lastSeen < 0 {
lastSeen = 1
}
current := rp.Current
if current && lastSeen > lostQuorumInterval {
current = false

View File

@@ -3369,7 +3369,7 @@ func TestAccountNATSResolverFetch(t *testing.T) {
}
connect := func(url string, credsfile string, acc string, srvs ...*Server) {
t.Helper()
nc := natsConnect(t, url, nats.UserCredentials(credsfile))
nc := natsConnect(t, url, nats.UserCredentials(credsfile), nats.Timeout(5*time.Second))
nc.Close()
require_NoLocalOrRemoteConnections(acc, srvs...)
}

View File

@@ -492,8 +492,11 @@ func (ms *memStore) removeMsg(seq uint64, secure bool) bool {
}
if ms.scb != nil {
// We do not want to hold any locks here.
ms.mu.Unlock()
delta := int64(ss)
ms.scb(-1, -delta, seq, sm.subj)
ms.mu.Lock()
}
return ok