aboutsummaryrefslogtreecommitdiff
path: root/db_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move code to src/ and tests/EuAndreh2024-10-251-1545/+0
|
* Clean up timeout tests.Ben Johnson2016-12-271-161/+0
| | | | | | The new FCTNL locking does not support multiple locks from the same process which makes those tests fail. The lock tests have been removed.
* add additional meta page testsBen Johnson2016-04-241-34/+56
|
* Merge pull request #482 from gyuho/bolt_db_test_fixBen Johnson2016-01-111-3/+3
|\ | | | | *: fix test print format
| * *: fix test print formatGyu-Ho Lee2016-01-081-3/+3
| |
* | Merge branch 'grow' of https://github.com/xiang90/bolt into xiang90-growBen Johnson2016-01-111-2/+8
|\ \ | |/ |/|
| * do not grow dbsize agressivelyXiang Li2015-11-061-2/+8
| | | | | | | | | | | | | | | | | | | | | | Only grow the database size when the high watermark increases. We also grows the database size a little bit aggressively to save a few ftruncates. I have tested this on various environments. The performance impact is ignorable with 16MB over allocation. Without over allocation, the performance might decrease 100% when each Tx.Commit needs a new page on a very slow disk (seek time dominates the total write).
* | test suite refactoringBen Johnson2016-01-021-317/+973
| | | | | | | | | | | | | | | | | | 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.
* | Introduce InitialMmapSize to prevent deadlockGyu-Ho Lee2015-12-211-0/+45
| | | | | | | | | | | | | | | | InitialMmapSize is the initial mmap size of the database in bytes. Read transaction won't block write transaction if InitialMmapSize is large enough to handle mmap size. Copied from https://github.com/boltdb/bolt/pull/432.
* | Make bolt.Open return the documented errorsRodolfo Carvalho2015-12-101-24/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ErrInvalid is returned when a data file is not a Bolt-formatted database. - ErrVersionMismatch is returned when the data file was created with a different version of Bolt. - ErrChecksum is returned when either meta page checksum does not match. Also: - Do not wrap errors from os.Stat, so that a caller could handle os.Stat errors just like it can handle errors from os.Open that bolt.Open might return. - Name tests consistently, following the pattern "TestOpen_*". - Remove deferred calls to `os.Remove(path)`. The calls are not only unnecessary, but also in all cases `os.Remove` returns an error that is ignored. All those calls are meant to remove a file that was already removed by `tmpfile()`. - Combine "bad path" tests and use filepath.Join to build the path.
* | Merge pull request #419 from raggi/windows-flockBen Johnson2015-10-281-6/+0
|\ \ | | | | | | windows: implement file locking
| * | windows: implement file lockingJames Tucker2015-09-161-6/+0
| |/
* / typosJohn ShaggyTwoDope Jenkins2015-10-131-1/+1
|/
* solaris: fix issues with mmap, munmap, madvise and flockKen Sedgwick2015-08-211-0/+10
|
* Wait for pending tx on close.Ben Johnson2015-05-201-1/+44
| | | | | This commit fixes the DB.Close() function so that it waits for any open transactions to finish before closing.
* Add test case inline documentation.Ben Johnson2015-05-181-4/+16
|
* use a shared lock in read-only modesasha-s2015-05-181-7/+10
| | | | https://github.com/boltdb/bolt/pull/371#issuecomment-103119486
* open read-only databases in read-only modesasha-s2015-05-141-0/+55
|
* Add transaction batchingTommi Virtanen2015-02-181-0/+28
| | | | | | 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.
* Fix large mmap resize.Ben Johnson2015-02-161-0/+61
| | | | | This commit fixes an issue where large databases were being resized to larger sizes on every open.
* Persist sequence-only changes.Ben Johnson2015-02-021-0/+3
| | | | | | | | | | 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
* Add additional error checks in test suite.Ben Johnson2015-01-281-6/+13
|
* Fix mmap resize calculation.Ben Johnson2015-01-281-0/+41
| | | | | | | | | 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: 6bb25854a183f3d3bfa50096f910d3a3984e9834
* Remove testify.Ben Johnson2014-07-261-144/+149
|
* Move tests to a test package.Ben Johnson2014-07-261-142/+64
|
* Remove wrapping test closures.Ben Johnson2014-07-261-165/+178
|
* Remove withTempPath() helper.Ben Johnson2014-07-251-128/+131
|
* Fix root split on very large append.Ben Johnson2014-07-231-8/+29
| | | | | | | 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).
* Remove unreachable test code.Ben Johnson2014-07-111-2/+0
|
* Recover from panics appropriately.Ben Johnson2014-07-111-0/+60
| | | | | | | 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).
* Merge branch 'master' of https://github.com/boltdb/bolt into free-cacheBen Johnson2014-07-101-2/+3
|\
| * Fix test for path errors.Ben Johnson2014-07-101-1/+1
| |
| * Fix Windows mmap sizing.Ben Johnson2014-07-101-1/+2
| | | | | | | | | | | | | | | | | | 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.
* | Add freelist cache.Ben Johnson2014-06-301-1/+1
|/ | | | | | 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.
* Copy the free pages stats from the receiverMartin Kobetic2014-06-271-0/+4
|
* Add Open() options, flock timeout.Ben Johnson2014-06-211-29/+61
| | | | | | | | 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.
* split the freelist page count stats to free and pendingMartin Kobetic2014-06-201-1/+2
|
* Fix merge-split regression.Ben Johnson2014-06-181-1/+1
| | | | | | | 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 up freelist stats naming and add FreeAllocMartin Kobetic2014-06-181-1/+1
|
* add freelist stats to db statsMartin Kobetic2014-06-171-1/+2
|
* Fix merge-split spill issues.Ben Johnson2014-06-031-0/+34
|
* Add freelist assertion on every free().Ben Johnson2014-05-291-0/+46
| | | | This commit performs a check on the freelist pages to ensure that a double free can never happen.
* Add streaming check.Ben Johnson2014-05-281-11/+4
| | | | | This commit changes Tx.Check() to return a channel through which check errors are returned. This allows errors to be found before checking the entire data file.
* Remove DB.Check(). Allow read-only Tx.Check().Ben Johnson2014-05-271-3/+6
| | | | | | | This commit removes the DB.Check() function and instead makes the user decide whether a transaction should be writable or read-only. Tx.Check() is not safe to use concurrently on a read-only transaction, however, it significantly improves the performance of it.
* Merge pull request #169 from benbjohnson/allocationBen Johnson2014-05-211-2/+2
|\ | | | | Fix freelist allocation direction.
| * Fix freelist allocate().Ben Johnson2014-05-191-2/+2
| |
* | move Copy and CopyFile from DB to TxMartin Kobetic2014-05-211-59/+2
|/
* Add inline bucket support.Ben Johnson2014-05-051-8/+2
| | | | | | | | | | | | | | | 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.
* Consolidate code for clarity.Ben Johnson2014-05-051-0/+12
| | | | | | 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.
* Printf's %s and %q do the right thing with []byte; removed string conversion.Kevin Gillette2014-04-251-4/+4
|