Ivan Valdes
7eb11b0d67
Fix debug sync log line
...
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-02-10 14:32:07 -08:00
Chun-Hung Tseng
a4adf65d6e
Fix linter reported issues
...
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
2024-08-16 17:14:17 +02:00
Thomas Jungblut
62e81c036f
introduce a freelist interface
...
This introduces an interface for the freelist, splits it into two concrete
implementations.
fixes etcd-io#773
Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2024-07-09 10:41:35 +02:00
Benjamin Wang
263e75d059
move method freePages into freelist.go
...
The motivation is to get all freelist related logic included
in freelist.go. We are going to introduce freelist interface
in the next step.
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2024-07-02 10:04:14 +01:00
Andy Xie
3a7dc77481
change FileMode var formatter to %s
...
Signed-off-by: Andy Xie <andy.xning@gmail.com>
2024-06-25 11:35:33 +08:00
Ivan Valdes
fbea5d610d
*: skip logging if logger is discardLogger
...
If there is no logger defined (discardLogger), skip logging altogether for
highly frequent called methods (Put, Delete, CreateBucket,
CreateBucketIfNotExists, DeleteBucket, Begin, Commit, Open, MoveBucket, Sync).
Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-04-30 06:16:37 -07:00
ChengenH
b005c0c435
chore: use errors.New to replace fmt.Errorf with no parameters will much better
...
Signed-off-by: ChengenH <hce19970702@gmail.com>
2024-04-21 21:35:18 +08:00
Benjamin Wang
4c7075efe6
add log messages
...
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2023-12-29 11:25:43 +00:00
Benjamin Wang
23c97d55e6
refactor the implementation of check
...
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2023-12-27 15:32:54 +00:00
caojiamingalan
7d93161fbd
add logger
...
Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
2023-11-27 17:08:16 +01:00
Benjamin Wang
26f89a5951
ensure the stats is always 64bit aligned
...
The first word in an allocated struct can be relied upon to be
64-bit aligned. Refer to https://pkg.go.dev/sync/atomic#pkg-note-BUG .
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-10-23 13:25:40 +01:00
Nuno Cruces
6340c70371
Documentation: remove note that Options.Timeout is Linux/macOS only
...
This seems to work on all platforms.
E.g. on Windows it seems to work since 1cb787ee7b
.
Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
2023-09-13 14:25:56 +01:00
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