pull/34/head
Ben Johnson 2014-01-30 17:04:56 -05:00
parent 5f1c96f08a
commit 8d5757e9dd
7 changed files with 24 additions and 26 deletions

View File

@ -95,7 +95,7 @@ func (b *branch) split(pageSize int) []*branch {
for index, item := range b.items {
nodeSize := bnodeSize + len(item.key)
if (len(current.items) >= minKeysPerPage && index < len(b.items)-minKeysPerPage && size+nodeSize > threshold) {
if len(current.items) >= minKeysPerPage && index < len(b.items)-minKeysPerPage && size+nodeSize > threshold {
size = pageHeaderSize
branches = append(branches, current)
current = &branch{}
@ -119,4 +119,3 @@ type branchItem struct {
func (s branchItems) Len() int { return len(s) }
func (s branchItems) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s branchItems) Less(i, j int) bool { return bytes.Compare(s[i].key, s[j].key) == -1 }

View File

@ -93,7 +93,7 @@ func (l *leaf) split(pageSize int) []*leaf {
for index, item := range l.items {
nodeSize := lnodeSize + len(item.key) + len(item.value)
if (len(current.items) >= minKeysPerPage && index < len(l.items)-minKeysPerPage && size+nodeSize > threshold) {
if len(current.items) >= minKeysPerPage && index < len(l.items)-minKeysPerPage && size+nodeSize > threshold {
size = pageHeaderSize
leafs = append(leafs, current)
current = &leaf{}
@ -117,4 +117,3 @@ type leafItem struct {
func (s leafItems) Len() int { return len(s) }
func (s leafItems) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s leafItems) Less(i, j int) bool { return bytes.Compare(s[i].key, s[j].key) == -1 }