This commit fixes a bug where deletions that caused merge-left rebalances were updating
the parent node which caused a node to "reappear" even after it had been deleted. This was
fixed in merge-right rebalances a while ago but merge-left is less frequent so it was
missed until now.
Many thanks to Jordan Sherer (@jsherer) for finding and reporting the bug.
This commit changes the node.split() functionality to check if the next node has
available space and, if so, it will merge the newly split keys into the next node.
Previously, keys could be continually put into the left side of a split causing that
first half to split off small right side nodes. This was especially problematic with
databases with a high fill percent.
This commit fixes the freelist so that it frees from the beginning of the data file
instead of the end. It also adds a fast path for pages which can be allocated from
the first free pages and it includes read transaction stats.
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.
This commit pluralizes the BucketStat type to be BucketStats. This makes it
more consistent with the other Stats() calls. This commit also changes the
return type to a struct instead of a pointer.
Finally, this commit adds documentation to the fields of BucketStats.
This commit changes the API for:
Tx.CreateBucket()
Tx.CreateBucketIfNotExists()
Bucket.CreateBucket()
Bucket.CreateBucketIfNotExists()
These functions now return the *Bucket and error instead of just the error.
This commit adds performance counters for each transaction which are rolled
up to the database level on each commit/rollback. Counters are meant to be
a very fast way to track what is going on in the database. A few timers are
also added in areas where the time.Now() overhead is not noticible.
The DB.Stat() function is now deprecated since the `bolt` CLI now performs
similar functions.
Fixes#108.
I consolidated the DB.Tx() and DB.RWTx() calls into a single
DB.Begin(writable bool) call. This is more consistent with the
database/sql library.
I also changed the DB.Do() and DB.With() call to DB.Update() and
DB.View(), respectively. This is more intuitive and more inline with
other database verbiage.
Functions such as DB.Put(), DB.Get(), and DB.Delete() were originally
added to be easy to use, however, after implementing Bolt in multiple
projects I have found these ease-of-use functions useless. Nearly
every use case requires multiple calls in a single transaction.
Using the DB ease of use functions turned out to be an antipattern.
I changed the Transaction/RWTransaction types to Tx/RWTx, respectively. This makes the naming
more consistent with other packages such as database/sql. The txnid is changed to txid as well.