Fix shutdown deadlock in TestJetStreamClusterMemLeaderRestart (#4430)

While shutting down a server an error during purge from a memory stream
would cause a deadlock sometimes, this would sometimes show up in the
`TestJetStreamClusterMemLeaderRestart` while tearing down the cluster.

This was introduced in
4d8d01949b
so only relates to v2.10.
This commit is contained in:
Waldemar Quevedo
2023-08-25 07:41:23 -07:00
committed by GitHub

View File

@@ -684,6 +684,7 @@ func (ms *memStore) purge(fseq uint64) (uint64, error) {
cb := ms.scb
bytes := int64(ms.state.Bytes)
if fseq < ms.state.LastSeq {
ms.mu.Unlock()
return 0, fmt.Errorf("partial purges not supported on memory store")
}
ms.state.FirstSeq = fseq