0
0

firestorm valid docNum finding, fixes #310

This commit is contained in:
Steve Yen 2016-01-06 16:04:56 -08:00
parent 7df07f94fa
commit 024848ac91

View File

@ -45,9 +45,10 @@ type Snapshot struct {
// if none, then 0 // if none, then 0
func (s *Snapshot) Which(docID []byte, docNumList DocNumberList) uint64 { func (s *Snapshot) Which(docID []byte, docNumList DocNumberList) uint64 {
sort.Sort(docNumList) sort.Sort(docNumList)
highestValidDocNum := docNumList.HighestValid(s.maxRead) for _, docNum := range docNumList { // docNumList is sorted descending.
if highestValidDocNum > 0 && s.Valid(docID, highestValidDocNum) { if docNum > 0 && s.Valid(docID, docNum) {
return highestValidDocNum return docNum
}
} }
return 0 return 0
} }