Commit Graph

829 Commits (012f88489b620a08d097a8972419f4f3d9f81d92)

Author SHA1 Message Date
Anthony Romano 012f88489b add PageSize to Option struct
Configure the db page size at runtime. Makes cross-arch debugging a bit easier.
2017-08-10 20:46:08 -07:00
Anthony Romano 78ca4fde00 get rid of os.Getpagesize() calls where appropriate 2017-08-10 20:46:08 -07:00
Anthony Romano 12923fe56c Merge pull request #12 from heyitsanthony/skip-freelist-overflow
freelist: read all free pages on count overflow
2017-08-10 14:28:08 -07:00
Anthony Romano b219ffc6cc Merge pull request #10 from heyitsanthony/fix-freepage-test
fix NoSyncFreelist reachability checking
2017-08-09 08:48:36 -07:00
Anthony Romano 7bc833016a Merge pull request #13 from heyitsanthony/weaken-single-put
test: use qconfig() instead of defaults in TestBucket_Put_Single
2017-08-09 08:41:24 -07:00
Anthony Romano fd5de8495a fix NoSyncFreelist reachability checking
* unconditionally free freelist, if any, when committing txn

* only treat freelist pages as reachable if set to valid pgid

Fixes #9
2017-08-09 07:24:02 -07:00
Anthony Romano 1038faf165 test: use qconfig() instead of defaults in TestBucket_Put_Single
Default/nil quick.Config uses 1000 rounds, causing TestBucker_Put_Single to
run for over 3 minutes in CI. The default count (via qconfig()) for boltdb
is 5, so use that.
2017-08-09 00:30:52 -07:00
Anthony Romano 03f5e16968 freelist: read all free pages on count overflow
count is not shifted up by start index when taking subslice of free
list, dropping the last entry in the list.
2017-08-08 23:38:46 -07:00
Anthony Romano f50ad8e90c test: check free page counts on close/reopen for freelist overflow
Confirm that the number of freed pages exceeds the overflow count, then check
that reopening gives the same number of free pages.
2017-08-08 23:37:24 -07:00
Gyu-Ho Lee 2ab139b399 Merge pull request #8 from gyuho/ci
gofmt, change git path
2017-07-27 15:05:25 -07:00
Gyu-Ho Lee a30394a020 *: update git paths to 'coreos/bbolt' 2017-07-27 14:58:03 -07:00
Gyu-Ho Lee 7ce671beee *: fix gofmt style issues in 'range' 2017-07-27 14:57:54 -07:00
Anthony Romano c359265bcd Merge pull request #6 from heyitsanthony/restore-freelist
rebuild freelist when opening with FreelistSync after NoFreelistSync
2017-07-25 10:02:42 -07:00
Anthony Romano 05bfb3bd9a rebuild freelist when opening with FreelistSync after NoFreelistSync
Writes pgidNoFreelist to the meta freelist page to detect when freelists
haven't been synced down.

Fixes #5
2017-07-25 08:01:43 -07:00
Xiang Li ad39960eb4 Merge pull request #3 from heyitsanthony/range-gc
Garbage collect pages allocated after minimum txid
2017-06-23 18:19:54 -07:00
Xiang Li 572a8e0d3f Merge pull request #1 from coreos/no_sync
add option to skip freelist sync
2017-06-22 12:52:29 -07:00
Xiang 7149270521 *: add option to skip freelist sync
When the database has a lot of freepages, the cost to sync all
freepages down to disk is high. If the total database size is
small (<10GB), and the application can tolerate ~10 seconds
recovery time, then it is reasonable to simply not sync freelist
and rescan the db to rebuild freelist on recovery.
2017-06-22 12:46:56 -07:00
Xiang Li bffefe5dd6 Merge pull request #4 from coreos/import_test
*: use coreos/bbolt as import path
2017-06-20 11:48:57 -07:00
Xiang 78b54a42e1 *: use coreos/bbolt as import path 2017-06-20 11:03:31 -07:00
Anthony Romano 78d099ed1f Garbage collect pages allocated after minimum txid
Read txns would lock pages allocated after the txn, keeping those pages
off the free list until closing the read txn. Instead, track allocating
txid to compute page lifetime, freeing pages if all txns between
page allocation and page free are closed.
2017-06-05 16:07:55 -07:00
Ben Johnson e9cf4fae01 Merge pull request #654 from benbjohnson/revert-ca9f208
Revert "replace unix implementation to be the same as solaris to fix …"
2017-01-31 12:20:18 -07:00
Ben Johnson 82ecdfe9ef
Revert "replace unix implementation to be the same as solaris to fix an issue with glusterfs"
This reverts commit ca9f2088aa.
2017-01-31 07:53:51 -07:00
Ben Johnson 9145e04770 Merge pull request #651 from zweizeichen/master
hexidecimal -> hexadecimal
2017-01-30 08:30:26 -07:00
Sebastian 4660afd75e hexidecimal -> hexadecimal
Small spelling fix :)
2017-01-28 10:26:39 +01:00
Ben Johnson a705895fda Merge pull request #642 from josharian/fix629
Ensure that keys generated by testing/quick are unique
2016-12-28 16:26:56 -07:00
Josh Bleecher Snyder 18ced60c94 Ensure that keys generated by testing/quick are unique
Quick seed 21691 used to generate duplicate keys, 
which caused some Puts of values to overwrite other values,
causing spurious test failures.

Fixes #629.
2016-12-28 14:09:56 -08:00
Ben Johnson b9eb643780
Clean up timeout tests.
The new FCTNL locking does not support multiple locks from the
same process which makes those tests fail. The lock tests have
been removed.
2016-12-27 15:28:53 -07:00
Ben Johnson 2c3edd782c Merge pull request #616 from sinwav/idiomatic
Fix return statement inside else block at the end of function
2016-12-27 14:08:26 -07:00
Ben Johnson ebe310138b Merge pull request #625 from vrecan/FcntlFlock
replace unix implementation to be the same as solaris to fix an issue with glusterfs
2016-12-27 14:07:51 -07:00
Ben Johnson f57d45558d Merge pull request #628 from bep/patch-1
Fix prefix scan example
2016-12-27 14:06:03 -07:00
Ben Johnson 2e25e3bb42 Merge pull request #641 from josharian/cleanup
Minor cleanup and bug fixes
2016-12-23 10:44:54 -07:00
Josh Bleecher Snyder 10c6e01e1f Allow GC to reclaim completed transactions
The existing append-based implementation left a hanging reference to
the last tx.

For example, if db.txs was:

[]*Tx{0x1, 0x2, 0x3, 0x4, 0x5}

and we removed the second element, db.txs would now be:

[]*Tx{0x1, 0x3, 0x4, 0x5, 0x5}[:4]

The garbage collector cannot reclaim anything anywhere in a slice,
even pointers between its len and cap, because the len can always
be extended up to the cap.

This hanging reference to the Tx could last indefinitely,
and since the Tx has a reference to user-provided functions,
which could be closures, this bug could prevent arbitrary
amounts of user garbage from being collected.

Since db.txs is unordered anyway, switch to a simpler--and O(1) instead
of O(n)--implementation. Swap the last element into the spot to be
deleted, nil out the original last element, and shrink the slice.
2016-12-23 09:18:57 -08:00
Josh Bleecher Snyder 7adfa44e02 Fix freelist.size calculation for large freelists
freelist.size did not account for the extra
fake freelist item used to hold the number of
elements when the freelist is large.
2016-12-23 09:18:57 -08:00
Josh Bleecher Snyder 0e120dc470 Precalculate size of pending pgids in freelist.copyall
This recovers the slight alloc regression in #636.
2016-12-23 09:18:47 -08:00
Josh Bleecher Snyder 1858583b3b Clean up after #636
freelist.lenall duplicated freelist.count.
freelist.copyall and mergepgids docs had typos.
2016-12-23 08:56:04 -08:00
Ben Johnson f0cf3bfd5b Merge pull request #636 from josharian/perf
Don't allocate huge slices to merge pgids in freelist.write
2016-12-21 16:46:06 -07:00
Ben Johnson 7614a4738b Merge pull request #638 from boltdb/fix-634
Document multi-process limitation in README
2016-12-21 08:52:53 -07:00
Ben Johnson 30095231de README
Add limitation about multiple processes opening databases concurrently.
2016-12-21 08:52:12 -07:00
Josh Bleecher Snyder 4d8824b05d Don't allocate huge slices to merge pgids in freelist.write
Using a large (50gb) database with a read-write-delete heavy load,
nearly 100% of allocated space came from freelists.
1/3 came from freelist.release, 1/3 from freelist.write,
and 1/3 came from tx.allocate to make space for freelist.write.
In the case of freelist.write, the newly allocated giant slice gets
copied to the space prepared by tx.allocate and then discarded.

To avoid this, add func mergepgids that accepts a destination slice,
and use it in freelist.write.

This has a mild negative impact on the existing benchmarks,
but cuts allocated space in my real world db by over 30%.

name                      old time/op    new time/op    delta
_FreelistRelease10K-8       18.7µs ±10%    18.2µs ± 4%    ~             (p=0.548 n=5+5)
_FreelistRelease100K-8       233µs ± 5%     258µs ±20%    ~             (p=0.151 n=5+5)
_FreelistRelease1000K-8     3.34ms ± 8%    3.13ms ± 8%    ~             (p=0.151 n=5+5)
_FreelistRelease10000K-8    32.3ms ± 1%    32.2ms ± 7%    ~             (p=0.690 n=5+5)
DBBatchAutomatic-8          2.18ms ± 3%    2.19ms ± 4%    ~             (p=0.421 n=5+5)
DBBatchSingle-8              140ms ± 6%     140ms ± 4%    ~             (p=0.841 n=5+5)
DBBatchManual10x100-8       4.41ms ± 2%    4.37ms ± 3%    ~             (p=0.548 n=5+5)

name                      old alloc/op   new alloc/op   delta
_FreelistRelease10K-8       82.5kB ± 0%    82.5kB ± 0%    ~     (all samples are equal)
_FreelistRelease100K-8       805kB ± 0%     805kB ± 0%    ~     (all samples are equal)
_FreelistRelease1000K-8     8.05MB ± 0%    8.05MB ± 0%    ~     (all samples are equal)
_FreelistRelease10000K-8    80.4MB ± 0%    80.4MB ± 0%    ~             (p=1.000 n=5+5)
DBBatchAutomatic-8           384kB ± 0%     384kB ± 0%    ~             (p=0.095 n=5+5)
DBBatchSingle-8             17.2MB ± 1%    17.2MB ± 1%    ~             (p=0.310 n=5+5)
DBBatchManual10x100-8        908kB ± 0%     902kB ± 1%    ~             (p=0.730 n=4+5)

name                      old allocs/op  new allocs/op  delta
_FreelistRelease10K-8         5.00 ± 0%      5.00 ± 0%    ~     (all samples are equal)
_FreelistRelease100K-8        5.00 ± 0%      5.00 ± 0%    ~     (all samples are equal)
_FreelistRelease1000K-8       5.00 ± 0%      5.00 ± 0%    ~     (all samples are equal)
_FreelistRelease10000K-8      5.00 ± 0%      5.00 ± 0%    ~     (all samples are equal)
DBBatchAutomatic-8           10.2k ± 0%     10.2k ± 0%  +0.07%          (p=0.032 n=5+5)
DBBatchSingle-8              58.6k ± 0%     59.6k ± 0%  +1.70%          (p=0.008 n=5+5)
DBBatchManual10x100-8        6.02k ± 0%     6.03k ± 0%  +0.17%          (p=0.029 n=4+4)
2016-12-20 14:32:15 -08:00
Ben Johnson d98e43f69e Merge pull request #618 from tbe/master
[ppc64] added missing variable
2016-12-20 07:40:02 -07:00
Bjørn Erik Pedersen 714f31f39e Fix prefix scan example
The example is correct in isolation, but if people just copy the loop, it will go into infinite loop when given an empty byte slice.
2016-12-06 21:38:41 +01:00
Ben Johnson 0d9f544bb9 Merge pull request #626 from timshannon/patch-1
Added BoltHold and Ironsmith to the projects list
2016-11-21 09:51:43 -07:00
Tim Shannon a8a17933aa Added BoltHold and Ironsmith to the projects list 2016-11-20 21:14:40 -06:00
Ben Aldrich ca9f2088aa replace unix implementation to be the same as solaris to fix an issue with glusterfs 2016-11-16 02:08:01 +00:00
Ben Johnson 315c65d4cf Merge pull request #621 from jcvernaleo/jcv_readme
Add btcwallet and dcrwallet to projects using bolt.
2016-11-09 15:02:51 -07:00
John C. Vernaleo 01cb4852fd Make wording a little less redundant. 2016-11-09 16:43:38 -05:00
John C. Vernaleo 021e7e8a8c Add btcwallet and dcrwallet to projects using bolt. 2016-11-08 08:39:53 -05:00
tbe 84658f4d37 [ppc64] added missing variable
The variable `brokenUnaligned` was missing for ppc64.
2016-11-04 12:25:04 +01:00
nick ac86fb9530 Fix return statement inside else block at the end of function and gofmt windows file
Signed-off-by: nick <nicholasjamesrusso@gmail.com>
2016-10-31 20:49:40 -07:00
Ben Johnson 4b1ebc1869 Merge pull request #611 from jaredfolkins/master
enhc: update example for nested buckets
2016-10-28 13:36:45 -06:00