Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#373 Follow-up #375

Merged
merged 2 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ jobs:
fail-fast: false
matrix:
target:
- linux-amd64-unit-test-1-cpu
- linux-amd64-unit-test-2-cpu
- linux-amd64-unit-test-4-cpu
- linux-amd64-unit-test-4-cpu-freelist-hashmap-race
- linux-amd64-unit-test-2-cpu-freelist-array-short-race
- linux-amd64-unit-test-4-cpu-race
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,14 +21,23 @@ jobs:
TARGET: ${{ matrix.target }}
run: |
case "${TARGET}" in
linux-amd64-unit-test-1-cpu)
CPU=1 make test
;;
linux-amd64-unit-test-2-cpu)
CPU=2 make test
;;
linux-amd64-unit-test-4-cpu)
CPU=4 make test
;;
linux-amd64-unit-test-4-cpu-freelist-hashmap-race)
CPU=4 ENABLE_RACE=true make test-freelist-hashmap
;;
linux-amd64-unit-test-2-cpu-freelist-array-short-race)
CPU=2 ENABLE_RACE=true EXTRA_TESTFLAGS="-short" make test-freelist-array
linux-amd64-unit-test-4-cpu-race)
# XXX: By default, the Github Action runner will terminate the process
# if it has high resource usage. Try to use GOGC to limit memory and
# cpu usage here to prevent unexpected terminating. It can be replaced
# with GOMEMLIMIT=2048MiB if the go-version is updated to >=1.19.x.
#
# REF: https://github.com/actions/runner-images/issues/6680#issuecomment-1335778010
GOGC=30 CPU=4 ENABLE_RACE=true make test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will run race mode for freelist-array as well? I recall that you mentioned running race mode for freelist-array will fail with high possibility? can you clarify this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will run race mode for freelist-array as well?

Yes. make test will run cases for both hashmap and freelist.

I recall that you mentioned running race mode for freelist-array will fail with high possibility?

Yes. It happened yesterday (I run the CI in my forked repo action https://github.com/fuweid/bbolt/actions).
But in this morning, it failed random.... ( So I try to use GOGC env to limit the usage and run it 7 times successfully.
Hopefully it is not flaky in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thx for the clarification.

;;
*)
echo "Failed to find target"
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ fmt:
lint:
golangci-lint run ./...

test: test-freelist-hashmap test-freelist-array

test-freelist-hashmap:
test:
@echo "hashmap freelist test"
TEST_FREELIST_TYPE=hashmap go test -v ${TESTFLAGS} -timeout 30m
TEST_FREELIST_TYPE=hashmap go test -v ${TESTFLAGS} ./cmd/bbolt

test-freelist-array:
@echo "array freelist test"
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} ./cmd/bbolt
Expand All @@ -40,4 +37,4 @@ coverage:
TEST_FREELIST_TYPE=array go test -v -timeout 30m \
-coverprofile cover-freelist-array.out -covermode atomic

.PHONY: fmt test test-freelist-hashmap test-freelist-array lint
.PHONY: fmt test lint
26 changes: 22 additions & 4 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,27 +673,45 @@ func (tx *Tx) Page(id int) (*PageInfo, error) {
// TxStats represents statistics about the actions performed by the transaction.
type TxStats struct {
// Page statistics.
//
// DEPRECATED: Use GetPageCount() or IncPageCount()
PageCount int64 // number of page allocations
// DEPRECATED: Use GetPageAlloc() or IncPageAlloc()
PageAlloc int64 // total bytes allocated

// Cursor statistics.
//
// DEPRECATED: Use GetCursorCount() or IncCursorCount()
CursorCount int64 // number of cursors created

// Node statistics
//
// DEPRECATED: Use GetNodeCount() or IncNodeCount()
NodeCount int64 // number of node allocations
// DEPRECATED: Use GetNodeDeref() or IncNodeDeref()
NodeDeref int64 // number of node dereferences

// Rebalance statistics.
Rebalance int64 // number of node rebalances
//
// DEPRECATED: Use GetRebalance() or IncRebalance()
Rebalance int64 // number of node rebalances
// DEPRECATED: Use GetRebalanceTime() or IncRebalanceTime()
RebalanceTime time.Duration // total time spent rebalancing

// Split/Spill statistics.
Split int64 // number of nodes split
Spill int64 // number of nodes spilled
//
// DEPRECATED: Use GetSplit() or IncSplit()
Split int64 // number of nodes split
// DEPRECATED: Use GetSpill() or IncSpill()
Spill int64 // number of nodes spilled
// DEPRECATED: Use GetSpillTime() or IncSpillTime()
SpillTime time.Duration // total time spent spilling

// Write statistics.
Write int64 // number of writes performed
//
// DEPRECATED: Use GetWrite() or IncWrite()
Write int64 // number of writes performed
// DEPRECATED: Use GetWriteTime() or IncWriteTime()
WriteTime time.Duration // total time spent writing to disk
}

Expand Down