Off by one bug (surprise) that would skip first new message on deliver last per subject.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2021-07-30 15:18:00 -07:00
parent 22af59f758
commit 170b0570d4
2 changed files with 3 additions and 3 deletions

View File

@@ -2659,7 +2659,7 @@ func (o *consumer) selectStartingSeqNo() {
} else if o.cfg.DeliverPolicy == DeliverLastPerSubject {
if mss := o.mset.store.SubjectsState(o.cfg.FilterSubject); len(mss) > 0 {
o.lss = &lastSeqSkipList{
resume: stats.LastSeq + 1,
resume: stats.LastSeq,
seqs: createLastSeqSkipList(mss),
}
o.sseq = o.lss.seqs[0]

View File

@@ -12302,11 +12302,11 @@ func TestJetStreamDeliverLastPerSubject(t *testing.T) {
checkNext("kv.b1.baz", 65, "11")
msg := []byte(fmt.Sprintf("%d", 22))
js.Publish("kv.b2.foo", msg) // Not filtered through..
js.Publish("kv.b1.bar", msg)
js.Publish("kv.b2.foo", msg) // Not filtered through..
checkSubsPending(t, sub, 1)
checkNext("kv.b1.bar", 68, "22")
checkNext("kv.b1.bar", 67, "22")
})
}
}