Commit Graph

73 Commits (5f9559f227d35426880a20cda02363ee0e27fb2b)

Author SHA1 Message Date
Luke Champine 5f9559f227 Document undefined behavior in ForEach 2015-09-21 15:49:06 -04:00
Ben Johnson 112f143631 Document key/value safety.
This commit adds safety documentation to the data accessor functions
in Bolt as well as the README. This was documented once in the package
level godoc but it's important enough that it should be more clear.
2015-03-24 11:06:28 -06:00
Ben Johnson ac1149a3f5 Persist sequence-only changes.
This commit fixes a bug where only calling NextSequence() on a Bucket does not cause the Bucket to be
peristed. The simple fix is to simply materialize the root node so that the bucket is flushed out
during commit.

Thanks to Matthew Dawson (@MJDSys) for reporting.

https://github.com/boltdb/bolt/issues/296
2015-02-02 08:27:34 -07:00
Ben Johnson b4d00c394a Expand assertion statements.
This commit expands calls to _assert() that use variadic arguments. These calls require conversion to interface{} so there
was a large number of calls to Go's internal convT2E() function. In some profiling this was taking over 20% of total runtime.
I don't remember seeing this before Go 1.4 so perhaps something has changed.
2015-01-30 14:15:49 -05:00
Ben Johnson f088575049 Fix split root dereference.
This commit fixes a bug that occurs when a root node is split just after a re-mmap occurs.
Previously, this would cause a panic because the new root node would still reference
keys from the old mmap.
2014-08-21 22:49:58 -06:00
Ben Johnson ba6badc57f Move tests to a test package. 2014-07-26 15:11:47 -06:00
Ben Johnson cb17016062 Add FillPercent documentation. 2014-07-24 11:25:25 -06:00
Ben Johnson c3400efefd Change fill percent to be per-bucket.
This commit moves the DB.FillPercent field to Bucket.FillPercent. This
allows the fill percentage to be specified per-bucket, per-tx. This
value is not persisted and should be set whenever using it.
2014-07-24 10:36:09 -06:00
Ben Johnson 642b104396 Add DefaultOptions variable.
This commit adds an explicit DefaultOptions variable for additional documentation.
Open() can still be passed a nil options which will cause options to be change to
the DefaultOptions variable. This change also allows options to be set globally for
an application if more than one database is being opened in a process.

This commit also moves all errors to errors.go so that the godoc groups them together.
2014-06-22 12:44:20 -06:00
Ben Johnson 0f585358f4 Change Bucket.NextSequence() to return uint64.
This commit changes NextSequence() to return a uint64 instead of an int. This also
removes the ErrSequenceOverflow error condition since overflowing a uint64 is unlikely.

Fixes #39.
2014-06-22 09:33:28 -06:00
Ben Johnson 54cad40a78 Fix merge-split spill issues. 2014-06-03 13:40:24 -06:00
Ben Johnson 06b01dbb67 Remove allocations from read-only buckets. 2014-05-23 10:40:09 -06:00
Ben Johnson e728eb90da Minor stats fixes. 2014-05-14 12:06:31 -06:00
Martin Kobetic 6eaeb31424 address review comments 2014-05-13 17:28:17 +00:00
Martin Kobetic 0716cdaec8 tweaks 2014-05-12 19:33:53 +00:00
Martin Kobetic 0dbfa3f08a merge inline branch into leaf branch 2014-05-12 18:22:45 +00:00
Martin Kobetic deffc06a05 fix inline bucket stats 2014-05-12 17:29:16 +00:00
Martin Kobetic c4ad027df7 aggregate bucket stats recursively and add stats to cmd 2014-05-09 20:50:58 +00:00
Martin Kobetic b9899d09ab first part 2014-05-09 20:50:55 +00:00
Ben Johnson d1b21e619d Merge branch 'master' of https://github.com/boltdb/bolt into fix-deletion
Conflicts:
	node.go
2014-05-09 09:38:08 -06:00
Ben Johnson a5cb717fc7 Fix deletion reclamation. 2014-05-09 09:26:34 -06:00
Martin Kobetic d279ea44ce add asserts for detecting pgid high watermark overflow 2014-05-09 13:35:00 +00:00
Ben Johnson d52d142275 Minor fixes. 2014-05-07 12:06:22 -06:00
Ben Johnson e99a24eb44 Improve bucket code documentation. 2014-05-07 11:23:30 -06:00
Ben Johnson 0966dde0d4 Fix bucket free. 2014-05-07 10:37:50 -06:00
Ben Johnson 55e71b0902 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.
2014-05-05 16:39:55 -06:00
Ben Johnson c3903d38a1 Consolidate code for clarity.
This commit consolidates some of the smaller files into some of the larger files.
The smaller files cluttered the file tree and made it harder to see the logical
groupings of structs.
2014-05-05 07:56:54 -06:00
Ben Johnson 25fea2fd9f Refactor split/spill. 2014-05-03 16:21:28 -06:00
Ben Johnson e3ed193646 Copy key on Put() and CreateBucket().
This commit makes a copy of the key byte slice before inserting into the database.
This fixes the issue where users may reuse byte buffers which can corrupt the database.

Fixes #143.
2014-04-29 06:54:01 -06:00
Ben Johnson 0567eea5f5 Change to BucketStats and Bucket.Stats().
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.
2014-04-22 15:11:49 -06:00
Martin Kobetic a02ddf402b rename MaxDepth to Depth 2014-04-22 20:32:09 +00:00
Martin Kobetic 4245fd9c4e allign naming with MemStats 2014-04-22 20:22:18 +00:00
Martin Kobetic 62592ec840 moar tweaks 2014-04-22 20:18:09 +00:00
Martin Kobetic 382ccc2746 add Used/Free Leaf/Branch bucket stats 2014-04-22 18:22:42 +00:00
Steven Normore b178373351 build c/cursor and running tests 2014-04-16 13:29:52 +00:00
Ben Johnson 2505b9a7dc Return bucket from CreateBucket() functions.
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.
2014-04-15 23:45:06 -04:00
Ben Johnson 698b07b074 Add nested buckets.
This commit adds the ability to create buckets inside of other buckets.
It also replaces the buckets page with a root bucket.

Fixes #56.
2014-04-11 12:36:54 -06:00
Ben Johnson 686b6a3341 Add performance counters.
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.
2014-04-02 16:03:03 -06:00
Ben Johnson 59fde2f664 Error refactoring.
Fixed up a few error issues and refactored out the Error type.
2014-03-24 08:31:15 -06:00
Ben Johnson 482f00fdfc Add ErrTxClosed error.
Commit/Rollback and mutable calls on Tx and Bucket now return ErrTxClosed
if the transaction has already been committed or rolled back. Non-mutable
calls have added an assertion to check if the transaction is closed which
will cause a panic. I don't want to introduce an error return for accessor
methods that are being used improperly so I think the panic is appropriate.
2014-03-23 12:20:16 -06:00
binz 540d94614d fix 32bit build fails: bucket.go#67 2014-03-23 13:54:51 +08:00
Ben Johnson 1c7b59a4c2 Merge pull request #65 from benbjohnson/fix-tx-buckets-sort-order
Fix Tx.Buckets() sort order.
2014-03-21 08:45:34 -06:00
Ben Johnson 26afa92faf Fix Bucket.ForEach() comment. 2014-03-15 09:14:20 -06:00
Ben Johnson 62cf02e21a Fix Tx.Buckets() sort order.
@tv42 reported an issue with bucket names returning incorrectly. Not sure if
this fixes the issue but it is necessary anyway.
2014-03-13 15:08:59 -06:00
Ben Johnson c551e45a47 Consolidate Tx and RWTx. 2014-03-08 20:40:48 -07:00
Ben Johnson 57376f0905 Rename Transaction to Tx.
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.
2014-03-08 17:04:02 -07:00
Ben Johnson a1f43f4d60 Allow reads of unflushed nodes.
This commit allows cursors to read updated values from within the
RWTransaction.
2014-03-01 09:13:59 -07:00
Ben Johnson a544249dd8 Refactor Bucket. 2014-02-23 08:32:53 -07:00
Ben Johnson 3b2fd8f2d3 Revert "Refactor Transaction/Bucket API."
This reverts commit 1ad2b99f28.
2014-02-22 22:54:54 -07:00
Ben Johnson 1ad2b99f28 Refactor Transaction/Bucket API. 2014-02-21 22:57:50 -07:00