Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ permissions:
checks: write

jobs:
install-jq:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
trunk-code-quality:
name: Trunk Code Quality
uses: hypermodeinc/.github/.github/workflows/trunk.yml@main
2 changes: 1 addition & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins:
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.23.5
- go@1.24.5
- [email protected]
- [email protected]

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [Unreleased]

- chore(deps): Upgrade to Go 1.24.5 and downstream indirect packages dependencies
- chore(test): Adapt the test.sh script to run on OS-X (as well as Linux)
- chore: skip protoc generation if protoc is missing or not correct version
- chore(deps): Remove dependency on github.com/pkg/errors (#2184)
- chore(deps): Migrate from OpenCensus to OpenTelemetry (#2169)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/pflag v1.0.7 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
Expand Down
19 changes: 18 additions & 1 deletion pb/gen.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
#!/bin/bash

# Run this script from its directory, so that badgerpb4.proto is where it's expected to
# be.
# be. Only run this script if you've made changes to the API in badgerpb4.proto.
Copy link
Member

Choose a reason for hiding this comment

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

what's the harm in running it anyway?


# Check if protoc version matches expected version first
EXPECTED_PROTOC_VERSION="3.21.12"
ACTUAL_PROTOC_VERSION=$(protoc --version 2>/dev/null | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' || true)

if [[ ${ACTUAL_PROTOC_VERSION} != "${EXPECTED_PROTOC_VERSION}" ]]; then
echo "Warning: protoc version mismatch"
echo "Expected: ${EXPECTED_PROTOC_VERSION}"
echo "Actual: ${ACTUAL_PROTOC_VERSION:-'not found'}"
echo "Skipping generation"
exit 0
fi

go install google.golang.org/protobuf/cmd/[email protected]

# Get the GOPATH and add the bin directory to PATH
GOPATH=$(go env GOPATH)
export PATH="${GOPATH}/bin:${PATH}"

protoc --go_out=. --go_opt=paths=source_relative badgerpb4.proto
7 changes: 4 additions & 3 deletions pb/protos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import (
func Exec(argv ...string) error {
cmd := exec.Command(argv[0], argv[1:]...)

if err := cmd.Start(); err != nil {
return err
output, err := cmd.CombinedOutput()
if len(output) > 0 {
print(string(output))
}
return cmd.Wait()
return err
}

func TestProtosRegenerate(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions stream_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ func TestStreamWriterIncremental(t *testing.T) {
t.Run("multiple incremental with older data first", func(t *testing.T) {
runBadgerTest(t, nil, func(t *testing.T, db *DB) {
buf := z.NewBuffer(10<<20, "test")
defer func() { require.NoError(t, buf.Release()) }()
KVToBuffer(&pb.KV{
Key: []byte("a1"),
Value: []byte("val1"),
Expand All @@ -755,7 +754,6 @@ func TestStreamWriterIncremental(t *testing.T) {
require.NoError(t, sw.Flush(), "sw.Flush() failed")

buf = z.NewBuffer(10<<20, "test")
defer func() { require.NoError(t, buf.Release()) }()
KVToBuffer(&pb.KV{
Key: []byte("a2"),
Value: []byte("val2"),
Expand All @@ -766,6 +764,9 @@ func TestStreamWriterIncremental(t *testing.T) {
require.NoError(t, sw.Write(buf), "sw.Write() failed")
require.NoError(t, sw.Flush(), "sw.Flush() failed")

// Single defer at the end to release the final buffer
Copy link
Member

Choose a reason for hiding this comment

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

there are two different buffers that we are trying to release. This does not seem right

defer func() { require.NoError(t, buf.Release()) }()

// This will move the maxTs to 10 (earlier, without the fix)
require.NoError(t, db.Update(func(txn *Txn) error {
return txn.Set([]byte("a1"), []byte("val3"))
Expand Down
8 changes: 4 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ manual() {
rm -rf p
set -e
go test $tags $timeout $covermode $coverprofile -run='TestTruncateVlogNoClose$' -failfast --manual=true && write_coverage || return 1
truncate --size=4096 p/000000.vlog
dd if=/dev/null of=p/000000.vlog bs=1 seek=4096 count=0 2>/dev/null
go test $tags $timeout $covermode $coverprofile -run='TestTruncateVlogNoClose2$' -failfast --manual=true && write_coverage || return 1
go test $tags $timeout $covermode $coverprofile -run='TestTruncateVlogNoClose3$' -failfast --manual=true && write_coverage || return 1
rm -rf p
Expand Down Expand Up @@ -78,9 +78,9 @@ stream() {
pushd badger
baseDir=$(mktemp -d -p .)
./badger benchmark write -s --dir=$baseDir/test | tee $baseDir/log.txt
./badger benchmark read --dir=$baseDir/test --full-scan | tee --append $baseDir/log.txt
./badger benchmark read --dir=$baseDir/test -d=30s | tee --append $baseDir/log.txt
./badger stream --dir=$baseDir/test -o "$baseDir/test2" | tee --append $baseDir/log.txt
./badger benchmark read --dir=$baseDir/test --full-scan | tee -a $baseDir/log.txt
./badger benchmark read --dir=$baseDir/test -d=30s | tee -a $baseDir/log.txt
./badger stream --dir=$baseDir/test -o "$baseDir/test2" | tee -a $baseDir/log.txt
count=$(cat "$baseDir/log.txt" | grep "at program end: 0 B" | wc -l)
rm -rf $baseDir
if [ $count -ne 4 ]; then
Expand Down
Loading