From 55e71b090259eb775c1bb74a2c3ec23bdfba8db5 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 5 May 2014 10:27:02 -0600 Subject: Add inline bucket support. This commit adds support for writing small buckets directly inline to their value in their parent's leaf node. Previously, subbuckets would simply have a bucket header stored in their parent bucket which pointed to the root page. This required that every bucket use at least a single page. This has a high overhead for buckets with only one or two small items. Inline buckets checks subbuckets to see if they only have a small amount of data (about 1kb) and no subbuckets. If these conditions are met then the bucket's root node is written to a fake page which is simply a pointer to the end of the bucket's header. Fixes #124. --- freelist.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'freelist.go') diff --git a/freelist.go b/freelist.go index ebe2810..6c527fe 100644 --- a/freelist.go +++ b/freelist.go @@ -1,6 +1,7 @@ package bolt import ( + "fmt" "sort" "unsafe" ) @@ -63,7 +64,7 @@ func (f *freelist) free(txid txid, p *page) { } f.pending[txid] = ids - // DEBUG ONLY: f.check() + f.check() // DEBUG ONLY: } // release moves all page ids for a transaction id (or older) to the freelist. @@ -114,7 +115,6 @@ func (f *freelist) write(p *page) { // check verifies there are no double free pages. // This is slow so it should only be used while debugging. // If errors are found then a panic invoked. -/* func (f *freelist) check() { var lookup = make(map[pgid]txid) for _, id := range f.ids { @@ -132,7 +132,6 @@ func (f *freelist) check() { } } } -*/ type reverseSortedPgids []pgid -- cgit v1.2.3