Skip to content

Commit

Permalink
Bump badger to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonip committed Dec 16, 2024
1 parent d1b93c9 commit d175b05
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 58 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.0
require (
github.com/KimMachineGun/automemlimit v0.7.0-pre.3
github.com/cespare/xxhash/v2 v2.3.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dgraph-io/badger/v4 v4.4.0
github.com/dustin/go-humanize v1.0.1
github.com/elastic/apm-aggregation v1.1.0
github.com/elastic/apm-data v1.14.4
Expand Down Expand Up @@ -60,11 +60,9 @@ require (
require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/axiomhq/hyperloglog v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
Expand All @@ -73,8 +71,7 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/containerd/containerd v1.7.24 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgraph-io/ristretto v0.2.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dgraph-io/ristretto/v2 v2.0.0 // indirect
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
github.com/dlclark/regexp2 v1.8.1 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
Expand All @@ -98,9 +95,11 @@ require (
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomodule/redigo v1.8.9 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/h2non/filetype v1.1.3 // indirect
Expand Down Expand Up @@ -145,6 +144,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.elastic.co/apm/module/apmzap/v2 v2.6.2 // indirect
go.elastic.co/ecszap v1.0.2 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/consumer v1.21.0 // indirect
go.opentelemetry.io/collector/semconv v0.115.0 // indirect
Expand Down
79 changes: 36 additions & 43 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x-pack/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"sync"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/gofrs/uuid/v5"
"golang.org/x/sync/errgroup"

Expand Down
2 changes: 1 addition & 1 deletion x-pack/apm-server/sampling/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package sampling
import (
"time"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/pkg/errors"

"github.com/elastic/apm-data/model/modelpb"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/apm-server/sampling/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package sampling_test
import (
"testing"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
5 changes: 2 additions & 3 deletions x-pack/apm-server/sampling/eventstorage/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package eventstorage

import (
"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"

"github.com/elastic/apm-server/internal/logs"
"github.com/elastic/elastic-agent-libs/logp"
Expand Down Expand Up @@ -34,11 +34,10 @@ func OpenBadger(storageDir string, valueLogFileSize int64) (*badger.DB, error) {
const tableLimit = 4
badgerOpts := badger.DefaultOptions(storageDir).
WithLogger(&LogpAdaptor{Logger: logger}).
WithTruncate(true). // Truncate unreadable files which cannot be read.
WithNumMemtables(tableLimit). // in-memory tables.
WithNumLevelZeroTables(tableLimit). // L0 tables.
WithNumLevelZeroTablesStall(tableLimit * 3). // Maintain the default 1-to-3 ratio before stalling.
WithMaxTableSize(int64(16 << 20)). // Max LSM table or file size.
WithBaseTableSize(int64(16 << 20)). // Max LSM table or file size.
WithValueLogFileSize(valueLogFileSize) // vlog file size.

return badger.Open(badgerOpts)
Expand Down
2 changes: 1 addition & 1 deletion x-pack/apm-server/sampling/eventstorage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync/atomic"
"time"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"

"github.com/elastic/apm-data/model/modelpb"
)
Expand Down
2 changes: 1 addition & 1 deletion x-pack/apm-server/sampling/eventstorage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/gofrs/uuid/v5"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/gofrs/uuid/v5"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/apm-server/sampling/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"sync/atomic"
"time"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"

Expand Down

0 comments on commit d175b05

Please sign in to comment.