1105 Commits

Author SHA1 Message Date
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
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
d04dc0c2d0 Support running workflow on Windows-latest
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-27 14:49:58 +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
Benjamin Wang
329eba7818 Open db file in readonly mode for commands which shouldn't update db file
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-27 12:58:32 +08:00
Piotr Tabor
d4831e6217
Merge pull request #358 from ptabor/20221218-defensive-pageread
Validate page being fetched at possition 'p' self identifies as page 'p'
2022-12-23 11:07:33 +01:00
Piotr Tabor
86ce028a52 Defensive: Expect page that node writes onto to be zeroed.
I've seen data corruption that seen like a random bit-flip
or application on already allocated page.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-23 09:43:03 +01:00
Piotr Tabor
3cbd9c9a44 Detect pages that have multiple flags set.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-23 09:43:03 +01:00
Piotr Tabor
d1aa8034d4 Validate page being fetched at possition 'p' self identifies as page 'p'.
It's the easiest verification whether the page is actually written, or its 'random' garbage in the block.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-23 09:37:41 +01:00
Piotr Tabor
109f510a5e
Merge pull request #359 from ptabor/20221219-bbolt-page-all
bbolt page supports --all and --value-format=redacted formats.
2022-12-22 10:05:21 +01:00
Piotr Tabor
577a4d99b9 bbolt page supports --all and --value-format=redacted formats.
--all - prints all pages (only skips pages that were considered successful overflow pages)
--value-format=redacted just prints a length of the value, to reduce length and protect privacy.

The auto & redacted formats are supported in all tools that accept '--format'.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-22 09:56:16 +01:00
Piotr Tabor
4b8c53388b
Merge pull request #250 from x1ddos/sort-order-docs
bucket,cursor: clarify sort order and seek algorithm
2022-12-21 22:07:36 +01:00
Piotr Tabor
1231aef645
Merge pull request #241 from adream307/master
remove unreachable code
2022-12-21 22:05:57 +01:00
Piotr Tabor
a3749e4c36
Merge pull request #287 from dramirez-qb/patch-1
Update README.md fixed typo
2022-12-21 21:39:15 +01:00
Piotr Tabor
696c85ce3d
Merge pull request #356 from ptabor/20221215-flags
Add internal iterator to Bucket that goes over buckets.
2022-12-21 12:58:50 +01:00
Piotr Tabor
ebca452da7 Add internal iterator to Bucket that goes over buckets.
So far the code was frequently traversing all the keys (ignoring flag whether key is a bucket)
and trying to open each of the keys as bucket (seeking the same entry from the scratch).

In this proposal, we iterate only through bucket keys.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-21 12:16:50 +01:00