Skip to content

Commit

Permalink
Merge pull request #375 from fuweid/213-follow-up
Browse files Browse the repository at this point in the history
#373 Follow-up
  • Loading branch information
ahrtr authored Jan 5, 2023
2 parents a938f00 + c1ce3b5 commit ff5cb3f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
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
;;
*)
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

0 comments on commit ff5cb3f

Please sign in to comment.