aboutsummaryrefslogtreecommitdiff
path: root/bucket_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move code to src/ and tests/EuAndreh2024-10-251-1909/+0
|
* Minor bolt compact revisionsBen Johnson2016-09-051-0/+42
|
* set slice capacityBen Johnson2016-03-251-0/+40
| | | | | | | | | | | | | This commit sets the capacity on slices returned from `Bucket.Get()` to match the slice length. Previously the capacity would be the size of the mmap max size. This does not cause any backwards compatibility issues, however, it does allow users to `append()` to the returned slice since that will cause Go to realloc a new slice on the heap. Fixes #544
* *: fix test print formatGyu-Ho Lee2016-01-081-56/+56
|
* test suite refactoringBen Johnson2016-01-021-568/+1226
| | | | | | | | | This commit refactors the test suite to make it cleaner and to use the standard testing library better. The `assert()`, `equals()`, and `ok()` functions have been removed and some test names have been changed for clarity. No functionality has been changed.
* In TestBucket_Delete_FreelistOverflow, use Cursor.Delete to remove records.Matthew Dawson2015-10-171-1/+1
| | | | | | | When removing all the keys from the bucket, use Cursor.Delete directly, which avoids a seek through the bucket to find the element to delete. This knocks 1/5 of the time off my laptop when running this test while not reducing the amount of overflow pages cleared out of the free list.
* Fix Drone CI.Ben Johnson2015-06-041-0/+4
| | | | | | | This commit ignores the TestBucket_Put_ValueTooLarge test on Drone CI because the containers do not have enough memory. This test will still be run by anyone else who runs the test suite so that will still provide coverage.
* bucket_test: add test for ErrValueTooLarge on insertMatt Layher2015-05-121-0/+12
|
* Persist sequence-only changes.Ben Johnson2015-02-021-0/+27
| | | | | | | | | | 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
* Remove testify.Ben Johnson2014-07-261-172/+171
|
* Move tests to a test package.Ben Johnson2014-07-261-106/+107
|
* Remove wrapping test closures.Ben Johnson2014-07-261-714/+720
|
* Change fill percent to be per-bucket.Ben Johnson2014-07-241-2/+1
| | | | | | 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.
* Fix root split on very large append.Ben Johnson2014-07-231-0/+25
| | | | | | | This commit fixes a bug where a root split on a very large insert would cause an overflow of the root node. The problem was that the new root was not split when it was created so a new root with more than 64K child nodes would overflow the page.count (uint16).
* Allow freelist overflow.Ben Johnson2014-07-101-4/+3
| | | | | | | | | | | This commit is a backwards compatible change that allows the freelist to overflow the page.count (uint16). It works by checking if the overflow will occur and marking the page.count as 0xFFFF and setting the actual count to the first element of the freelist. This approach was used because it's backwards compatible and it doesn't make sense to change the data type of all page counts when only the freelist's page can overflow. Fixes #192.
* Merge pull request #208 from benbjohnson/open-timeoutBen Johnson2014-06-221-3/+3
|\ | | | | Add Open() options, flock timeout.
| * Add Open() options, flock timeout.Ben Johnson2014-06-211-3/+3
| | | | | | | | | | | | | | | | This commit changes Open() to provide an additional Options argument. The options argument currently only has a Timeout which will cause the Open() to return ErrTimeout if a file lock cannot be obtained in time. Fixes #207.
* | Change Bucket.NextSequence() to return uint64.Ben Johnson2014-06-221-22/+4
|/ | | | | | | 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.
* Fix merge-split regression.Ben Johnson2014-06-181-12/+12
| | | | | | | This commit reverts merge-split and fixes the node.split() to do a multi-page split. This issue caused problems with bulk loading because it would split into a small page and a very large page. The very large page, in turn, would be an arbitrary size so when it was freed later it would be difficult to reuse and would cause serious fragmentation issues.
* Fix freelist rollback.Ben Johnson2014-06-131-4/+7
|
* Fix double free in merge-left rebalance.Ben Johnson2014-06-061-0/+45
| | | | | | | | | 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.
* Fix merge-split spill issues.Ben Johnson2014-06-031-10/+15
|
* Allow split nodes to be merged with the next node.Ben Johnson2014-06-021-17/+61
| | | | | | | | | 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.
* Fix `ExampleBucket_Put` to use `db.View` instead of `db.Update`.yosssi2014-05-311-1/+1
|
* Fix freelist allocation direction.Ben Johnson2014-05-191-17/+8
| | | | | | 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.
* Minor stats fixes.Ben Johnson2014-05-141-11/+33
|
* tweaksMartin Kobetic2014-05-121-8/+13
|
* merge inline branch into leaf branchMartin Kobetic2014-05-121-3/+37
|
* fix inline bucket statsMartin Kobetic2014-05-121-45/+57
|
* aggregate bucket stats recursively and add stats to cmdMartin Kobetic2014-05-091-0/+44
|
* Fix bucket free.Ben Johnson2014-05-071-0/+27
|
* Add inline bucket support.Ben Johnson2014-05-051-10/+10
| | | | | | | | | | | | | | | 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.
* Refactor split/spill.Ben Johnson2014-05-031-21/+82
|
* Printf's %s and %q do the right thing with []byte; removed string conversion.Kevin Gillette2014-04-251-3/+3
|
* Change to BucketStats and Bucket.Stats().Ben Johnson2014-04-221-36/+36
| | | | | | | | 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.
* rename MaxDepth to DepthMartin Kobetic2014-04-221-3/+3
|
* skip space assertions for incompatible page sizeMartin Kobetic2014-04-221-14/+22
|
* allign naming with MemStatsMartin Kobetic2014-04-221-15/+15
|
* moar tweaksMartin Kobetic2014-04-221-18/+38
|
* update stats testMartin Kobetic2014-04-221-0/+8
|
* Return bucket from CreateBucket() functions.Ben Johnson2014-04-151-19/+36
| | | | | | | | | | | 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.
* Add nested buckets.Ben Johnson2014-04-111-102/+422
| | | | | | | This commit adds the ability to create buckets inside of other buckets. It also replaces the buckets page with a root bucket. Fixes #56.
* Add performance counters.Ben Johnson2014-04-021-3/+0
| | | | | | | | | | | | 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.
* Add DB.Check().Ben Johnson2014-03-291-0/+1
|
* Make DB/Tx API more consistent.Ben Johnson2014-03-241-29/+29
| | | | | | | | | | 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.
* Error refactoring.Ben Johnson2014-03-241-3/+4
| | | | Fixed up a few error issues and refactored out the Error type.
* Remove ease-of-use functions from the DB type.Ben Johnson2014-03-211-140/+183
| | | | | | | | | 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.
* Skip long-running tests with go test -shortTommi Virtanen2014-03-131-0/+16
|
* Consolidate Tx and RWTx.Ben Johnson2014-03-081-34/+34
|
* Rename Transaction to Tx.Ben Johnson2014-03-081-11/+11
| | | | | 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.