1120 Commits

Author SHA1 Message Date
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
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
Piotr Tabor
1f46d6c7e7 cmd/main_test.go is using btesting as well.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-28 15:18:46 +01: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
93380c59e8 testing: group (reorder) imports.
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
Piotr Tabor
46cdbf5b6c Factor out (bolt)testing library.
Thanks to putting it outside the bbolt_test package it can be used to test other packages.
The replacement of the bbolt_test variant inlined in db_test.go is to be performed in a follow up PR.

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
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
5dbd2ec7f3
Merge pull request #366 from ahrtr/workflow_windows_20221227
Support running workflow on Windows-latest
2022-12-28 15:49:41 +08:00
Benjamin Wang
7cc5901171 Extended the test timeout to 30m
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-27 14:51:47 +08:00