1331 Commits

Author SHA1 Message Date
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
Benjamin Wang
6652d8269e
Merge pull request #385 from ahrtr/add_surgery_revert_meta_page_20230116
Add `bbolt surgery revert-meta-page` command
2023-01-16 20:30:24 +08:00
Benjamin Wang
ff467f2ff5 addresed review comments
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-16 19:08:53 +08:00
Benjamin Wang
8df4afc24b add 'bbolt surgery revert-meta-page' command
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-16 18:32:41 +08:00
Benjamin Wang
da3f312335
Merge pull request #384 from ahrtr/base_command_20230116
move all common fields into baseCommand
2023-01-16 18:23:17 +08:00
Benjamin Wang
376af859cb move all common fields into baseCommand
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-16 14:58:01 +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
eb0deb9550 Refactor common code within key-order checker.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +01:00
Piotr Tabor
80edaf14f0 Rename: pgid pgid => pgId pgid to avoid confusion.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +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
ee27a544ca Recursive checker: Final touches.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +01:00
Piotr Tabor
710c33fe89 Tests for recursive checker (working on a corrupted files).
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
Piotr Tabor
0ccb16dc02 Mechanical move of Check functions to tx_check.go file.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-13 19:14:45 +01:00
Benjamin Wang
ece0e3dec2
Merge pull request #362 from ahrtr/protect_rollback_20221221
Add protection when `mmap` somehow fails
2023-01-13 06:45:07 +08: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
63d0cb428d cleanup data and dataaz when unmapping db on Windows platform
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-12 07:17:08 +08:00
Benjamin Wang
ad85400db2
Merge pull request #381 from ahrtr/loadfreepage_20230111
add PreLoadFreelist to support loading free pages in readonly mode
2023-01-11 19:49:35 +08:00
Benjamin Wang
d2fae80500 add protection on (*Tx)Page method in case free pages are not preloaded
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-11 18:39:32 +08:00
Benjamin Wang
06c66acf48 add test case TestOpenWithPreLoadFreelist
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-11 18:10:12 +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
Piotr Tabor
51c763c4e9
Merge pull request #377 from ahrtr/update_gitignore_20230109
add /cmd/bbolt/bbolt into .gitignore
2023-01-11 10:13:11 +01:00
Piotr Tabor
90a882e711
Merge pull request #379 from ahrtr/dependabot_20230111
security: add dependabot.yml
2023-01-11 10:12:26 +01:00
Benjamin Wang
df7540e2f4 security: add dependabot.yml
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-11 06:00:23 +08:00
Benjamin Wang
3037d91410 add /cmd/bbolt/bbolt into .gitignore
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-09 12:59:07 +08:00
Benjamin Wang
ff5cb3fe59
Merge pull request #375 from fuweid/213-follow-up
#373 Follow-up
2023-01-05 16:56:57 +08:00
Wei Fu
c1ce3b5ca8 .github: use GOGC=30 to prevent high resource usage
* Remove duplicate targets in Makefile
* Use GOGC=30 to prevent high resource usage

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-05 13:54:16 +08:00
Wei Fu
c99164bcd9 TxStats: add DEPRECATED comments for exported fields
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-05 10:31:00 +08:00
Benjamin Wang
a938f00609
Merge pull request #373 from fuweid/fix-213
fix data race on tx.Stats
2023-01-05 06:46:28 +08:00
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
b7f2da4843 .github/Makefile: support EXTRA_TESTFLAGS for array freelist
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-04 20:05:20 +08:00
Piotr Tabor
501d460add
Merge pull request #361 from ptabor/20221220-guts
Extract from bbolt/CLI library for low-level inspection and modifications
2023-01-04 09:51:33 +01:00
Piotr Tabor
bf9b712eb2 Add Test whether XRay finds path to a bucket as well.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-03 19:02:55 +01:00
Piotr Tabor
9f841cc213 Fix goimports and scripts.
Signed-off-by: Piotr Tabor <ptab@google.com>
2023-01-03 19:02:55 +01: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
Wei Fu
5104c82310 .github: split test job into test-{linux/windows}
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-03 15:27:42 +08:00
Wei Fu
f8fa3644b5 .github: run coverage in individual job
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-03 14:57:15 +08:00
Wei Fu
99a93a69f2 Enable -race in github action
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-03 14:36:10 +08:00
Wei Fu
27ac0b8958 fix data race on tx.Stats
Fixes: #213

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-01-02 22:29:43 +08:00
Piotr Tabor
8961219de8 Execution of ./scripts/fix.sh
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 12:59:02 +01:00
Piotr Tabor
cec7209fa8 Script that fixes all goimports.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 12:59:02 +01:00
Piotr Tabor
9a6782574d Add library that allows to perform low-level changes/inspection on bbolt file.
For sake of usage it in tests and CLI (so internal).

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 12:59:02 +01:00
Benjamin Wang
b654ce9221
Merge pull request #368 from ahrtr/update_readme_20221229
Update guide/command to get or install bbolt
2022-12-29 18:19:48 +08:00
Benjamin Wang
c2edb1308f Update guide/command to get or install bbolt
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-29 17:29:28 +08:00
Benjamin Wang
cc44e8614e
Merge pull request #367 from ahrtr/resolve_conflict_20221229
Resolve conflict
2022-12-29 17:24:47 +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
fc83b20869 Factor out low-lever access to pages out of CLI into internal/guts.
Long-term guts_cli should get replaced by the main code from bbolt main code.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-28 16:53:03 +01:00
Piotr Tabor
a0def3434b
Merge pull request #360 from ptabor/20221220-btesting
Factor out (bolt)testing library.
2022-12-28 16:14:12 +01:00