diff --git a/server/filestore_test.go b/server/filestore_test.go index 45370cf7bb6..93d27e2acc4 100644 --- a/server/filestore_test.go +++ b/server/filestore_test.go @@ -79,8 +79,8 @@ func TestFileStoreBasics(t *testing.T) { defer fs.Stop() subj, msg := "foo", []byte("Hello World") - now := time.Now().UnixNano() for i := 1; i <= 5; i++ { + now := time.Now().UnixNano() if seq, ts, err := fs.StoreMsg(subj, nil, msg); err != nil { t.Fatalf("Error storing msg: %v", err) } else if seq != uint64(i) { diff --git a/server/jetstream_cluster.go b/server/jetstream_cluster.go index e76bda67430..be8c35b0976 100644 --- a/server/jetstream_cluster.go +++ b/server/jetstream_cluster.go @@ -3161,11 +3161,11 @@ func (js *jetStream) processStreamLeaderChange(mset *stream, isLeader bool) { // Clear clseq. If we become leader again, it will be fixed up // automatically on the next processClusteredInboundMsg call. - mset.mu.Lock() + mset.clMu.Lock() if mset.clseq > 0 { mset.clseq = 0 } - mset.mu.Unlock() + mset.clMu.Unlock() } // Tell stream to switch leader status. @@ -7721,7 +7721,7 @@ func (mset *stream) processClusteredInboundMsg(subject, reply string, hdr, msg [ if mset.inflight == nil { mset.inflight = make(map[uint64]uint64) } - if mset.cfg.Storage == FileStorage { + if stype == FileStorage { mset.inflight[mset.clseq] = fileStoreMsgSize(subject, hdr, msg) } else { mset.inflight[mset.clseq] = memStoreMsgSize(subject, hdr, msg)