Commit Graph

748 Commits (97aba5586d36f9670a77dc6e60ec1b9ef31ce9ae)

Author SHA1 Message Date
sasha-s bdc109bdc7 fix `slice bounds out of range`/maxAllocSize bugs
when accessing the node data we used to use cast to
*[maxAllocSize]byte, which breaks if we try to go across maxAllocSize boundary.

This leads to occasional panics.
Sample stacktrace:
```
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/boltdb/bolt.(*node).write(0xc208010f50, 0xc27452a000)
    $GOPATH/src/github.com/boltdb/bolt/node.go:228 +0x5a5
github.com/boltdb/bolt.(*node).spill(0xc208010f50, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/node.go:364 +0x506
github.com/boltdb/bolt.(*node).spill(0xc208010700, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/node.go:336 +0x12d
github.com/boltdb/bolt.(*node).spill(0xc208010620, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/node.go:336 +0x12d
github.com/boltdb/bolt.(*Bucket).spill(0xc22b6ae880, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/bucket.go:535 +0x1c4
github.com/boltdb/bolt.(*Bucket).spill(0xc22b6ae840, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/bucket.go:502 +0xac2
github.com/boltdb/bolt.(*Bucket).spill(0xc22f4e2018, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/bucket.go:502 +0xac2
github.com/boltdb/bolt.(*Tx).Commit(0xc22f4e2000, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/tx.go:150 +0x1ee
github.com/boltdb/bolt.(*DB).Update(0xc2080e4000, 0xc24d077508, 0x0, 0x0)
    $GOPATH/src/github.com/boltdb/bolt/db.go:483 +0x169
```
It usually happens when working with large (50M/100M) values.
One way to reproduce it is to change maxAllocSize in bolt_amd64.go to 70000 and run the tests.
TestBucket_Put_Large crashes.
2015-04-16 11:58:02 -07:00
Ben Johnson 3ad30436da Add 'bolt dump' command. 2015-04-16 11:13:34 -06:00
Ben Johnson dd542876fa Add improved CLI documentation. 2015-04-15 15:21:50 -06:00
Ben Johnson d0e8a99e30 Refactor bolt CLI. 2015-04-14 16:32:20 -06:00
Ben Johnson 3b449559cf Add --path to bolt bench. 2015-04-12 09:36:45 -06:00
Ben Johnson 5edfe08f65 Merge pull request #347 from mike-marcacci/patch-1
Added InfluxDB to list of projects using bolt
2015-04-11 19:58:53 -06:00
Mike Marcacci c50df3a891 Added InfluxDB to list of projects using bolt 2015-04-11 18:16:07 -07:00
Ben Johnson ee954308d6 Merge pull request #342 from chrislusf/master
Adding used by Seaweed File System
2015-03-29 14:20:00 -06:00
chrislusf 393eacd1fe Update README.md 2015-03-29 13:05:23 -07:00
chrislusf 4eced79bd1 Update README.md 2015-03-29 13:04:56 -07:00
Ben Johnson 8b138fd106 Merge pull request #340 from DSpeichert/master
Update README.md: fixed type mismatch
2015-03-28 17:06:38 -06:00
Daniel Speichert 597d69fa1e Update README.md: fixed type mismatch 2015-03-28 18:59:17 -04:00
Ben Johnson 73b849dfc2 Merge pull request #336 from boltdb/reclamation-docs
README
2015-03-27 16:14:54 -06:00
Ben Johnson a8ee2caab1 Add link to page reclamation comment. 2015-03-27 16:13:55 -06:00
Ben Johnson 9d1dd87a79 README
Document use of free pages and page reclamation works.
2015-03-27 15:27:32 -06:00
Ben Johnson 63ec32ef32 Merge pull request #334 from funkygao/master
fix doc bug and add comment for db.dataref
2015-03-25 09:32:52 -06:00
funkygao 6d043164a9 add comment: db.dataref is readonly 2015-03-25 22:05:58 +08:00
funkygao 20852b29c4 fix comment bug: minium db mmapSize is 1MB instead of 4MB 2015-03-25 22:04:41 +08:00
Ben Johnson 837170ea29 Merge pull request #333 from benbjohnson/document-key-value-safety
Document key/value safety.
2015-03-24 12:28:40 -06: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 a9651995e1 Merge pull request #330 from benbjohnson/tx-writer-to
Implement io.WriterTo interface on Tx.
2015-03-22 15:26:13 -06:00
Ben Johnson 4d30731e91 Merge pull request #285 from tv42/batch
Add transaction batching
2015-03-18 10:11:07 -06:00
Ben Johnson 8c6af54aec Implement io.WriterTo interface on Tx.
This commit moves the functionality in Tx.Copy() to Tx.WriteTo(). This
allows Tx to be used as an io.WriterTo which makes it easier to mock.

The Tx.Copy() function still exists but it's simply a wrapper around
Tx.WriteTo().
2015-03-18 08:23:55 -06:00
Ben Johnson 97a71126e7 Merge pull request #328 from baijum/bolt-article
link to Bolt article
2015-03-13 08:47:51 -06:00
Baiju Muthukadan ec2610abdb link to Bolt article 2015-03-12 17:54:06 +05:30
Ben Johnson cf33c9e0ca Merge pull request #318 from baijum/newline-info
new line after page size info print
2015-03-01 06:48:40 -07:00
Ben Johnson 4bed58d78d Merge pull request #319 from skirmish/bolt-arm-fix
Added max alloc size to arm.
2015-03-01 06:46:19 -07:00
Adam Polanski 0e91fffcbe Added max alloc size to arm. 2015-02-28 11:12:16 -05:00
Baiju Muthukadan 4ff9f866c5 new line after page size info print 2015-02-28 09:01:57 +05:30
Ben Johnson fba9b58d1e Merge pull request #317 from benbjohnson/32bit-max-alloc
Update max alloc size on 386 arch
2015-02-27 09:10:07 -07:00
Ben Johnson 349dacfd44 Update max alloc size on 386 arch. 2015-02-27 08:45:05 -07:00
Ben Johnson 1d9315e35b Merge pull request #315 from benbjohnson/max-alloc
Increase max array pointer size to 2GB.
2015-02-26 21:15:20 -07:00
Ben Johnson b9c28b721a Increase max array size to 2GB.
This commit changes the maxAllocSize from 256GB to 2GB to handle large
values. It was previously 0xFFFFFFF and I tried adding one more "F" but
it caused an "array too large" error. I played around with the value
some more and found that 0x7FFFFFFF (2GB) is the highest allowed value.

This does not affect how the data is stored. It is simply used for type
converting pointers to array pointers in order to utilize zero copy
from the mmap.
2015-02-26 16:01:58 -07:00
Ben Johnson a7d19d8cd5 Merge pull request #314 from vdemario/fix_typo_readme
Fixed missing parenthesis on the readme
2015-02-23 12:57:44 -07:00
Vitor De Mario d6a67f7cce Fixed missing parenthesis on the readme 2015-02-23 16:35:38 -03:00
Tommi Virtanen adbb1a19c1 Add transaction batching
DB.Batch makes it easy to make lots of small transactions with
significantly better performance. Batch combines multiple concurrent
Update calls into a single disk transaction, managing errors smartly.
2015-02-18 12:26:45 -08:00
Ben Johnson 8be3a28087 Merge pull request #309 from everdev/operation-go
added gocode.io to list of projects using bolt
2015-02-17 21:49:48 -07:00
everdev 656f479184 added gocode.io to list of projects using bolt 2015-02-17 17:10:32 -08:00
Ben Johnson c8ecb61df2 Merge pull request #304 from benbjohnson/fix-large-resize
Fix large mmap resize
2015-02-16 16:45:58 -07:00
Ben Johnson e7f5c931e2 Fix large mmap resize.
This commit fixes an issue where large databases were being resized to
larger sizes on every open.
2015-02-16 15:23:48 -07:00
Ben Johnson 75f70a1938 README
Removed reference to LMDB's append mode being unsafe.
2015-02-16 08:09:08 -07:00
Ben Johnson b8dbe1101d Merge pull request #297 from benbjohnson/seq
Persist sequence-only changes
2015-02-02 09:11:18 -07: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 b124606822 Merge pull request #294 from benbjohnson/assert
Expand assertion statements
2015-02-02 07:49:02 -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 681a5db8f6 Merge pull request #292 from benbjohnson/fix-size
Fix mmap resize calculation.
2015-01-28 16:58:01 -05:00
Ben Johnson 338d8e78e2 Fix max mmap check for 32-bit arch. 2015-01-28 16:27:06 -05:00
Ben Johnson dacc1873d1 Fix mmap step & max size check.
This commit adds fixes suggested by @tv42 for the mmap step fix in 834b38e:

* Check max size before calculating the new the mmap size.
* Fix mmap step loop to go to 1GB instead of 512MB.
2015-01-28 13:03:30 -05:00
Ben Johnson 4e3fb8d60b Add additional error checks in test suite. 2015-01-28 11:52:08 -05:00
Ben Johnson 834b38e3e7 Fix mmap resize calculation.
This commit fixes an issue where the database would grow whenever it was opened. This was caused by
a recent change that performed a truncation when the database grew. Now there are fixed growth sizes
for the database (1MB, 2MB, 4MB, 8MB, etc) up to 1GB and then the database will grow by 1GB when it
resizes.

See also: 6bb25854a1
2015-01-28 11:29:27 -05:00