Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Commit

Permalink
sort pgids on file open only if they aren't sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
funny-falcon committed Aug 17, 2015
1 parent 22696c5 commit 278ef9a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion freelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ func (f *freelist) read(p *page) {
copy(f.ids, ids)

// Make sure they're sorted.
sort.Sort(pgids(f.ids))
if len(f.ids) > 0 {
for i, v := range f.ids[:len(f.ids)-1] {
if f.ids[i+1] < v {
sort.Sort(pgids(f.ids))
break
}
}
}

// Rebuild the page cache.
f.reindex()
Expand Down

0 comments on commit 278ef9a

Please sign in to comment.