120 Commits

Author SHA1 Message Date
wpedrak
c69165412d Skip few long running tests in -short mode 2021-04-23 13:10:08 +02:00
lzhfromustc
981093d53c test: add buffer to a channel to avoid the goroutine leak 2021-03-24 11:43:11 -04:00
Gyuho Lee
4d27a42422
Merge pull request #206 from lzhfromustc/4_Fatal_misusages
Fix the misusage of t.Fatal() in 4 test functions
2020-03-19 11:27:51 -07:00
Josh Rickmar
543c40ab41 Fix unsafe pointer conversions caught by Go 1.14 checkptr 2020-03-18 21:18:39 -04:00
Ziheng Liu
59e65f9618 Fix the misusage of t.Fatal() in 4 test functions 2020-03-03 23:00:28 -05:00
Xingyu Chen
8693da9f4d use segregated hashmap to boost the freelist allocate and release performance (#141) 2019-01-25 10:30:05 -08:00
John Howard
7ee3ded59d Fix Windows flock/funlock race (#122)
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-12 13:56:54 -07:00
Gyuho Lee
76a4670663 *: update import paths "go.etcd.io/bbolt"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 08:15:54 -07:00
Paul
e06ec0a754 Fix Close() to also wait for view transactions and fix tests as well (#91)
* Fix testDB_Close_PendingTx to do something with the writable arg and stop it from closing twice

* Fix Close() to wait for view transactions by getting a full lock on mmaplock

* Fix the TestTx_Check_ReadOnly to close the view transaction

* Fix the TestTx_Commit_ErrTxNotWritable to close the view transaction
2018-08-27 19:56:38 -07:00
Gyuho Lee
0bff9a461c *: update import paths to "github.com/etcd-io/bbolt"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-27 19:25:01 -07:00
Anthony Romano
41fefe7322 test: check concurrent WriteTo operations aren't corrupted
Reliably triggers consistency check failures on ramdisk without freelist
free fix.
2017-11-16 08:16:58 -08:00
Gyu-Ho Lee
68861c5f87 db_test.go: remove temp files after tests
Was filling up all the disk space in Jenkins VMs.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-28 01:39:15 -07:00
Anthony Romano
e39821f3de *: fix gofmt errors and makefile test 2017-09-13 14:38:05 -07:00
lorneli
d294ec8a42 db: add test in read-only mode 2017-09-12 20:04:55 +08:00
Anthony Romano
a6c45c18c3 Merge pull request #16 from heyitsanthony/config-page-size
Options.PageSize
2017-08-11 10:43:09 -07:00
Anthony Romano
6b378d844e Merge pull request #18 from heyitsanthony/fmt
more fmt passes
2017-08-11 09:58:09 -07:00
Anthony Romano
1ab9756653 fix overflow breaking 32-bit test builds 2017-08-10 23:36:52 -07:00
Anthony Romano
32c9f9e929 pass unused 2017-08-10 22:07:25 -07:00
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
Gyu-Ho Lee
7ce671beee *: fix gofmt style issues in 'range' 2017-07-27 14:57:54 -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
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
78b54a42e1 *: use coreos/bbolt as import path 2017-06-20 11:03:31 -07: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
a5aec31dc3
add additional meta page tests 2016-04-24 14:09:45 -06:00
Ben Johnson
db0771a655 Merge pull request #482 from gyuho/bolt_db_test_fix
*: fix test print format
2016-01-11 15:58:33 -07:00
Ben Johnson
694a82a959 Merge branch 'grow' of https://github.com/xiang90/bolt into xiang90-grow 2016-01-11 14:47:01 -07:00
Gyu-Ho Lee
42ab7c097f *: fix test print format 2016-01-08 00:31:45 -08:00
Ben Johnson
8b08bd4a80 test suite refactoring
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.
2016-01-02 21:30:31 -07:00
Gyu-Ho Lee
082efcc23e Introduce InitialMmapSize to prevent deadlock
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.
2015-12-21 15:36:00 -08:00
Rodolfo Carvalho
058a7ab347 Make bolt.Open return the documented errors
- 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.
2015-12-10 18:39:03 +01:00
Xiang Li
e67705ed63 do not grow dbsize agressively
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).
2015-11-06 09:39:17 -08:00
Ben Johnson
119858097e Merge pull request #419 from raggi/windows-flock
windows: implement file locking
2015-10-28 12:21:53 -06:00
John ShaggyTwoDope Jenkins
a7a29a20cd typos 2015-10-13 17:14:11 -07:00
James Tucker
1cb787ee7b windows: implement file locking 2015-09-16 09:28:26 -03:00
Ken Sedgwick
2f4ba1c533 solaris: fix issues with mmap, munmap, madvise and flock 2015-08-21 14:44:13 -07:00
Ben Johnson
e929eba364 Wait for pending tx on close.
This commit fixes the DB.Close() function so that it waits for any
open transactions to finish before closing.
2015-05-20 16:10:07 -06:00
Ben Johnson
df52bd0803 Add test case inline documentation. 2015-05-18 13:45:02 -06:00
sasha-s
fda75748b5 use a shared lock in read-only mode
https://github.com/boltdb/bolt/pull/371#issuecomment-103119486
2015-05-18 11:07:19 -07:00
sasha-s
019bf5b010 open read-only databases in read-only mode 2015-05-14 15:43:13 -07: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
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
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
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: 6bb25854a183f3d3bfa50096f910d3a3984e9834
2015-01-28 11:29:27 -05:00
Ben Johnson
44e6192d2b Remove testify. 2014-07-26 17:17:03 -06:00
Ben Johnson
ba6badc57f Move tests to a test package. 2014-07-26 15:11:47 -06:00
Ben Johnson
ca2339d7cb Remove wrapping test closures. 2014-07-26 14:44:04 -06:00
Ben Johnson
06222e06de Remove withTempPath() helper. 2014-07-25 23:14:17 -06:00