Ishan Tyagi
7cab6be2ae
Documentation: standardised examples in README.md to use file mode:0600
...
Signed-off-by: Ishan Tyagi <ishantyagi25@gmail.com>
2023-07-26 00:27:38 +05:30
Benjamin Wang
fddd3ac7f7
remove field 'filesz' from DB
...
There is no reason to maintain a file size. It's only used
when mapping the db or growing the db; obviously neither
are hot path.
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-05-26 16:44:04 +08:00
Cenk Alti
05286ad2af
Do not create db file if opened read-only
...
Signed-off-by: Cenk Alti <cenkalti@gmail.com>
2023-05-17 15:17:51 -04:00
Benjamin Wang
465077b9e2
add failpoint 'resizeFileError' to simulate file.Truncate error
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-05-05 15:47:48 +08:00
Benjamin Wang
6adc0c47a6
move FreelistType from internal/common to top level package bbolt
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-12 07:32:45 +08:00
Benjamin Wang
feccc712f1
Export both FreelistArrayType and FreelistMapType so as to keep API compatibility
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-11 19:00:31 +08:00
Josh Rickmar
7a957f94b2
Introduce errors package and restore API compatibility
...
This moves the error variables that had been moved to the
internal/common package during recent refactoring to a non-internal
errors package, once again allowing consumers to test for particular
error conditions.
To preserve API compatibility with bbolt v1.3, these error variables
are also redefined in the bbolt package, with deprecation notice to
migrate to bbolt/errors.
Signed-off-by: Josh Rickmar <jrick@zettaport.com>
2023-04-06 13:26:30 +00:00
Benjamin Wang
e2c42548f2
update the error message when rollback unmap also fails
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-23 19:51:08 +08:00
Benjamin Wang
b2f3dd5dba
Perform unmap when failing to mlock or both meta pages corrupted
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-22 12:02:01 +08:00
Benjamin Wang
c00862aa7c
test: add failpoint for mlock operation
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-20 15:34:31 +08:00
Benjamin Wang
ea511567eb
refactor both bolt and guts_cli based on the common package
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-04 04:22:09 +08:00
caojiamingalan
505fc0f7af
complete all cleanup operations in db.close() even if there is an error in the middle
...
Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
2023-02-11 07:21:13 +08:00
Piotr Tabor
774edab623
Merge pull request #387 from uvletter/fix_grow
...
fix db.grow is unusable when NoFreelistSync is on
2023-01-19 19:21:15 +01:00
luv
460b77759e
fix db.grow is unusable when NoFreelistSync is on
...
Signed-off-by: tian <skylypig@gmail.com>
2023-01-19 22:33:51 +08:00
Benjamin Wang
f10bad3c8f
support injecting failpoints and add failpoint github workflow
...
Implemented first demo "TestFailpoint_MapFail"
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-16 20:32:16 +08:00
Piotr Tabor
51370e425a
Merge pull request #225 from ptabor/extend_checker2
...
Recursive checker implementation.
2023-01-14 12:03:10 +01:00
Piotr Tabor
f16e2522ce
Address review comments.
...
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +01:00
Piotr Tabor
0c8d75db1e
Recursive checker implementation.
...
Recursive checker confirms database consistency with respect to b-tree
key order constraints:
- keys on pages must be sorted
- keys on children pages are between 2 consecutive keys on parent
branch page).
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +01:00
Benjamin Wang
eabffad75a
add protection when mmap somehow fails
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-12 07:58:02 +08:00
Benjamin Wang
6bc57389f0
add PreLoadFreelist to support loading free pages in readonly mode
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-11 18:10:12 +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
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
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
Benjamin Wang
9830ab2f14
Merge pull request #365 from ahrtr/bolt_cmd_readonly_20221227
...
Open db file in readonly mode for commands which shouldn't update db file
2022-12-28 15:51:29 +08:00
Benjamin Wang
99fe21f5e0
Disabled linter on field 'dataref'
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-27 14:51:10 +08:00
Benjamin Wang
f8dc40c033
Removed the use of log and reorder the import items
...
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-27 13:05:12 +08:00
Piotr Tabor
1231aef645
Merge pull request #241 from adream307/master
...
remove unreachable code
2022-12-21 22:05:57 +01:00
Piotr Tabor
9c92be978a
Merge pull request #273 from wpedrak/mlock-flag
...
Add `Mlock` flag.
2021-04-26 22:55:25 +02:00
neza2017
1d7842a624
replace buf[:] with buf ( #238 )
2021-04-23 17:38:27 -07:00
wpedrak
ed2436f1f8
Add Mlock
flag.
...
`Mlock` flag will cause mlock on db file which will prevent memory swapping of it. Motivation of this commit (etcd): https://github.com/etcd-io/etcd/pull/12750
2021-04-22 16:01:45 +02:00
adream307
ea42d394b8
remove unreachable code
2020-08-28 11:10:49 +08:00
Marin Atanasov Nikolov
0362320deb
db.Path() resolves to db.file.Name() ( #168 )
2019-07-01 09:46:51 -07:00
Tom Payne
4af6cfab70
add OpenFile option ( #158 )
2019-05-10 14:16:40 -07:00
Xingyu Chen
8693da9f4d
use segregated hashmap to boost the freelist allocate and release performance ( #141 )
2019-01-25 10:30:05 -08:00
Xingyu Chen
f0ad07c7d4
add getFreePageIDs ( #140 )
2019-01-20 23:42:17 -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
3130a60889
db.go: clean up file descriptor on db.file.ReadAt fail
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-17 17:00:29 -07:00
CJ DiMaggio
818c231b78
Clean up file descriptors on failed database initialization
...
Fixes an issue where failing to open a non-existent database in ReadOnly
mode would make you unable to properly initialize it in ReadWrite mode
afterwards due to a hanging lock.
2018-03-17 14:51:58 -07:00
Rodrigo Coelho
584b1a3dba
Breaking the long line
2018-02-14 10:06:29 -02:00
Rodrigo Coelho
fafe4b70b5
Close waits for the transactions to finish
...
DB.Close() actually waits for the transactions to finish now, since the PR 377.
https://github.com/boltdb/bolt/pull/377
2018-02-13 20:02:24 -02:00
Tommi Virtanen
bcfcdab742
Remove unnecessary if in batch handling
...
This is safe, as the only place that creates call values always
explicitly sets err. It's a leftover from an earlier iteration of the
code.
2017-11-26 15:02:34 -08:00
Anthony Romano
bdfe4158f8
tx: load freelist on Check()
...
Otherwise, nil dereference on ReadOnly DB
Fixes #45
2017-09-21 16:38:29 -07:00
lorneli
ea18f34f9d
db: return t.Rollback directly in the end of View function
...
Make return line of db.View corresponding with db.Update.
2017-09-12 21:40:59 +08:00
Raphael Geronimi
3a49aacce1
Added support for no timeout locks on db files ( #35 )
...
No longer unconditionally sleeps if file lock is already held
2017-09-06 14:24:56 -07:00
Tyler Treat
69fa13f2f1
Add NoSync field to Options
...
This allows enabling NoSync when you only have access to the Options
passed into Open() and not the returned DB (as is frequently the case
with libraries).
2017-08-24 09:35:24 -07: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
2fe83be160
Merge pull request #19 from heyitsanthony/skip-freelist-read
...
do not read freelist if database opened readonly
2017-08-11 10:11:03 -07:00
Sokolov Yura aka funny_falcon
ec37ce8e9b
do not read freelist if database opened readonly
2017-08-10 22:30:40 -07:00