Commit Graph

421 Commits (f873035fc9053e2f325d2b4ab808cd2ad0027ff1)

Author SHA1 Message Date
Ben Johnson f873035fc9 Remove unreachable test code. 2014-07-11 10:07:24 -06:00
Ben Johnson ba4adce39b Merge pull request #220 from benbjohnson/handle-panic
Recover from panics appropriately.
2014-07-11 10:04:28 -06:00
Ben Johnson ac4838472d Recover from panics appropriately.
This commit adds a defer handler to ensure that transactions are always closed out - even
in the event of a panic within user code. It's recommended that applications always fail
in the event of a panic but some packages such as net/http will automatically recover
which is a problem (IHMO).
2014-07-11 09:54:10 -06:00
Ben Johnson fe9a0781e2 Merge pull request #219 from benbjohnson/freelist-overflow
Allow freelist overflow.
2014-07-10 15:06:19 -06:00
Ben Johnson 88c8709cb1 Remove ErrFreelistOverflow error. 2014-07-10 15:01:50 -06:00
Ben Johnson ce0754b0d3 Allow freelist overflow.
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.
2014-07-10 14:50:21 -06:00
Ben Johnson 4d4ae58c6d Merge pull request #215 from benbjohnson/free-cache
Add freelist cache.
2014-07-10 14:20:40 -06:00
Ben Johnson 333c586ed0 Clean up freelist reindex. 2014-07-10 14:16:26 -06:00
Ben Johnson cc8004c980 Merge branch 'master' of https://github.com/boltdb/bolt into free-cache 2014-07-10 14:00:32 -06:00
Ben Johnson 90fe8d9c12 Fix test for path errors. 2014-07-10 09:41:40 -06:00
Ben Johnson ca5f582710 Merge pull request #218 from benbjohnson/fix-win
Fix Windows mmap sizing.
2014-07-10 07:35:40 -06:00
Ben Johnson e903703e61 Fix Windows mmap sizing.
This commit fixes an issue on Windows where the database was doubling
when it was re-opened. This occurred because Windows has to truncate the
file to the mmap size and the mmap resizing code was doubling the size
whenever the DB size was at the next threshold. This has been changed so
that the DB size will double only when the DB size is above the next
threshold.
2014-07-10 07:11:01 -06:00
Ben Johnson d9a0f51bee Add 'Intro to BoltDB' link. 2014-07-07 08:39:59 -06:00
Ben Johnson def455554b Add freelist cache.
This commit adds a cache to the freelist which combines the available free pages and pending free pages in
a single map. This was added to improve performance where freelist.isFree() was consuming 70% of CPU time
for large freelists.
2014-06-30 08:01:41 -06:00
Ben Johnson e4ad031878 Merge pull request #214 from Shopify/fix_stats_sub
Copy the free pages stats from the receiver
2014-06-27 11:40:46 -06:00
Martin Kobetic 8c386e72f3 Copy the free pages stats from the receiver 2014-06-27 17:38:06 +00:00
Ben Johnson d1a77a9c82 Minor fix. 2014-06-24 11:58:46 -06:00
Ben Johnson 283c556aa8 Merge pull request #213 from Shopify/stats_sub2
Drop the *s guard in Stats.Sub()
2014-06-24 11:56:55 -06:00
Martin Kobetic bae0fbd290 review tweaks 2014-06-24 17:54:40 +00:00
Martin Kobetic ba79a0a355 drop the *s guard 2014-06-24 17:40:53 +00:00
Ben Johnson 78d08e0438 Merge pull request #212 from Shopify/stats_sub
Improve Stats.Sub()
2014-06-24 11:37:16 -06:00
Martin Kobetic 8dd18bd620 review tweaks 2014-06-24 17:19:50 +00:00
Martin Kobetic 32e22b3bb6 add some guards for nil pointers 2014-06-24 15:32:04 +00:00
Martin Kobetic bbee09da30 copy receiver stats in Stats.Sub() 2014-06-24 15:32:04 +00:00
Ben Johnson c45c4a1ae6 Merge pull request #210 from benbjohnson/default-options
Add DefaultOptions variable.
2014-06-22 14:19:26 -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 4f428feecc Merge pull request #208 from benbjohnson/open-timeout
Add Open() options, flock timeout.
2014-06-22 10:10:55 -06:00
Ben Johnson 622c1f1525 Merge pull request #209 from benbjohnson/next-seq-uint64
Change Bucket.NextSequence() to return uint64
2014-06-22 10:00:04 -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 00ee0da528 Add Open() options, flock timeout.
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.
2014-06-21 14:44:28 -06:00
Ben Johnson 0a59a75472 Merge pull request #206 from Shopify/pending_page_stats
Split the freelist page count stats to free and pending
2014-06-20 09:03:24 -06:00
Martin Kobetic 571f201672 split the freelist page count stats to free and pending 2014-06-20 14:53:25 +00:00
Ben Johnson 42b4cae0fd Merge pull request #202 from benbjohnson/refactor-split
Fix split-merge regression.
2014-06-19 07:17:36 -06:00
Ben Johnson b1dbd35da1 Fix merge-split regression.
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.
2014-06-18 16:16:58 -06:00
Ben Johnson 5043a9e839 Merge pull request #200 from benbjohnson/fix-i686
Fix i686 build error.
2014-06-18 15:28:43 -06:00
Ben Johnson 56de9902a8 Merge pull request #201 from Shopify/freelist_stats_cleanup
Fix up freelist stats naming and add FreeAlloc
2014-06-18 12:35:13 -06:00
Martin Kobetic 8a386756df fix up freelist stats naming and add FreeAlloc 2014-06-18 18:10:42 +00:00
Ben Johnson 515bf03ff9 Fix i686 build error. 2014-06-18 11:53:01 -06:00
Ben Johnson afd38460ef Merge pull request #199 from kardianos/patch-1
Update README.md
2014-06-18 10:04:45 -06:00
Daniel Theophanes c3ae6e7307 Update README.md 2014-06-18 09:02:06 -07:00
Ben Johnson 4e3b3d3b2d Merge pull request #198 from yosssi/patch-1
Add "BoltStore" link on README.md
2014-06-18 09:53:47 -06:00
Keiji Yoshida ce59819e84 Add "BoltStore" link on README.md
I completed creating [BoltStore](https://github.com/yosssi/boltstore) and added its link on README.md.
2014-06-18 15:24:52 +09:00
Ben Johnson f8365b732e Merge pull request #197 from Shopify/freelist_stats
Add freelist stats to db stats
2014-06-17 13:34:15 -06:00
Martin Kobetic 4918ce8301 drop mergeStats and move freelist stats update to Tx 2014-06-17 19:30:10 +00:00
Martin Kobetic c105316292 add freelist stats to db stats 2014-06-17 18:40:56 +00:00
Ben Johnson 41aa602f27 Document key/value lifecycle.
This commit adds a caveat to the godoc that explains how key and value
byte slices will only be valid for the life of the transaction.
2014-06-16 09:42:59 -06:00
Ben Johnson 0329b03f58 Merge pull request #193 from benbjohnson/check-freelist-overflow
Check for freelist overflow
2014-06-13 16:02:47 -06:00
Ben Johnson 4db99647eb Fix freelist rollback. 2014-06-13 15:50:47 -06:00
Ben Johnson 8137a18374 Merge pull request #194 from benbjohnson/fix-deadlock
Fix deadlock on remmap.
2014-06-13 12:29:59 -06:00
Ben Johnson defdb743cd Fix deadlock on remmap.
This commit fixes a deadlock situation that can occur when Bolt's database size crosses a threshold
and requires remapping the mmap.
2014-06-13 12:07:37 -06:00