Wei Fu
dd4458ce3a
TxStats: provides Getter/Inc functions
...
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-04 20:06:51 +08:00
Wei Fu
4e98e8fb3c
TestDB_Concurrent_WriteTo: copy option to fix data race
...
The test log:
==================
WARNING: DATA RACE
Write at 0x00c000388370 by goroutine 37:
go.etcd.io/bbolt/internal/btesting.MustOpenDBWithOption()
/home/runner/work/bbolt/bbolt/internal/btesting/btesting.go:52 +0x1c7
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo.func1()
/home/runner/work/bbolt/bbolt/db_test.go:685 +0x1f4
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo·dwrap·18()
/home/runner/work/bbolt/bbolt/db_test.go:714 +0x47
Previous write at 0x00c000388370 by goroutine 83:
go.etcd.io/bbolt/internal/btesting.MustOpenDBWithOption()
/home/runner/work/bbolt/bbolt/internal/btesting/btesting.go:52 +0x1c7
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo.func1()
/home/runner/work/bbolt/bbolt/db_test.go:685 +0x1f4
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo·dwrap·18()
/home/runner/work/bbolt/bbolt/db_test.go:714 +0x47
Goroutine 37 (running) created at:
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo()
/home/runner/work/bbolt/bbolt/db_test.go:714 +0x724
testing.tRunner()
/opt/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1259 +0x22f
testing.(*T).Run·dwrap·21()
/opt/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1306 +0x47
Goroutine 83 (running) created at:
go.etcd.io/bbolt_test.TestDB_Concurrent_WriteTo()
/home/runner/work/bbolt/bbolt/db_test.go:714 +0x724
testing.tRunner()
/opt/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1259 +0x22f
testing.(*T).Run·dwrap·21()
/opt/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1306 +0x47
==================
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-03 15:42:51 +08:00
Benjamin Wang
c19ea9b613
Handle the case of io.EOF when reading the second meta page
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-29 16:37:24 +08:00
Benjamin Wang
dab07c58b4
Update test cases TestOpen_ReadPageSize_FromMeta1_OS and TestOpen_ReadPageSize_FromMeta1_Given
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-29 09:10:57 +08:00
Benjamin Wang
7b6c235774
Merge pull request #294 from ahrtr/enhance_check_command
...
Get the page size from the second meta page if the first one is invalid
2022-12-29 06:46:34 +08:00
Piotr Tabor
37d72cc1cd
Use require.NoError in btesting.go
...
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-28 15:18:46 +01:00
Piotr Tabor
26cc5e3e8b
Tests: Migrate from test DB to btesting.DB
...
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-28 15:18:46 +01:00
Piotr Tabor
f3e164d8dd
Example: How to use the separated 'btesting' library.
...
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-28 15:18:46 +01:00
Benjamin Wang
2385046d41
replace all ioutil with os
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-28 16:56:01 +08:00
ahrtr
8e6a1168ae
get the page size from the second meta page if the first one is invalid
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-28 16:52:47 +08:00
Manuel Rüger
33c86c78ca
.github: Enable lint
...
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-10-20 22:47:35 +02:00
Manuel Rüger
9b606419b1
Run gofmt
...
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-10-20 21:09:53 +02:00
Manuel Rüger
fd6c0aa81a
Makefile: Move to golangci-lint
2022-03-26 00:28:02 +01:00
Benjamin
d5db64bdbf
upgrade golang to 1.17 and replace iouitl with io and os ( #297 )
2022-01-29 19:28:06 -08:00
JmPotato
685b13a4ef
Clean and simplify some code ( #279 )
...
* Clean and simplify some code
Signed-off-by: JmPotato <ghzpotato@gmail.com>
* Remove unused Makefile content
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2021-05-22 23:29:23 -07:00
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