Skip to content

Commit

Permalink
Upgrade Badger v3->Badger v4 (#5619)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Resolves #5611

## Description of the changes
- updated flag names that was changes from v3 to v4 causing the test's
to fail

## How was this change tested?
- test log in the comments

## Checklist
- [ ] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [ ] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: mehul gautam <mehulsharma4786@gmail.com>
  • Loading branch information
hellspawn679 committed Jun 14, 2024
1 parent 1830148 commit f9e5eb8
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 57 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/bsm/sarama-cluster v2.1.13+incompatible
github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b
github.com/dgraph-io/badger/v3 v3.2103.5
github.com/dgraph-io/badger/v4 v4.2.0
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/fsnotify/fsnotify v1.7.0
github.com/go-logr/zapr v1.3.0
Expand Down Expand Up @@ -92,7 +92,6 @@ require (
github.com/aws/aws-sdk-go v1.53.11 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down
41 changes: 2 additions & 39 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/storage/badger/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"time"

"github.com/dgraph-io/badger/v3"
"github.com/dgraph-io/badger/v4"
"github.com/spf13/viper"
"go.uber.org/zap"

Expand Down
16 changes: 8 additions & 8 deletions plugin/storage/badger/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestMaintenanceRun(t *testing.T) {

// This is to for codecov only. Can break without anything else breaking as it does test badger's
// internal implementation
vlogSize := expvar.Get("badger_v3_vlog_size_bytes").(*expvar.Map).Get(f.tmpDir).(*expvar.Int)
vlogSize := expvar.Get("badger_size_bytes_vlog").(*expvar.Map).Get(f.tmpDir).(*expvar.Int)
currSize := vlogSize.Value()
vlogSize.Set(currSize + 1<<31)

Expand Down Expand Up @@ -154,7 +154,7 @@ func TestMaintenanceCodecov(t *testing.T) {

func TestBadgerMetrics(t *testing.T) {
// The expvar is leaking keyparams between tests. We need to clean up a bit..
eMap := expvar.Get("badger_v3_lsm_size_bytes").(*expvar.Map)
eMap := expvar.Get("badger_size_bytes_lsm").(*expvar.Map)
eMap.Init()

f := NewFactory()
Expand All @@ -166,28 +166,28 @@ func TestBadgerMetrics(t *testing.T) {
mFactory := metricstest.NewFactory(0)
f.Initialize(mFactory, zap.NewNop())
assert.NotNil(t, f.metrics.badgerMetrics)
_, found := f.metrics.badgerMetrics["badger_v3_memtable_gets_total"]
_, found := f.metrics.badgerMetrics["badger_get_num_memtable"]
assert.True(t, found)

waiter := func(previousValue int64) int64 {
sleeps := 0
_, gs := mFactory.Snapshot()
for gs["badger_v3_memtable_gets_total"] == previousValue && sleeps < 8 {
for gs["badger_get_num_memtable"] == previousValue && sleeps < 8 {
// Wait for the scheduler
time.Sleep(time.Duration(50) * time.Millisecond)
sleeps++
_, gs = mFactory.Snapshot()
}
assert.Equal(t, gs["badger_v3_memtable_gets_total"], previousValue)
return gs["badger_v3_memtable_gets_total"]
assert.Equal(t, gs["badger_get_num_memtable"], previousValue)
return gs["badger_get_num_memtable"]
}

vlogSize := waiter(0)
_, gs := mFactory.Snapshot()
assert.EqualValues(t, 0, vlogSize)
assert.EqualValues(t, int64(0), gs["badger_v3_memtable_gets_total"]) // IntVal metric
assert.EqualValues(t, int64(0), gs["badger_get_num_memtable"]) // IntVal metric

_, found = gs["badger_v3_lsm_size_bytes"] // Map metric
_, found = gs["badger_size_bytes_lsm"] // Map metric
assert.True(t, found)

err := f.Close()
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/samplingstore/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"encoding/json"
"time"

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

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
jaegermodel "github.com/jaegertracing/jaeger/model"
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/samplingstore/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"
"time"

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

Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"sync"
"time"

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

"github.com/jaegertracing/jaeger/storage/spanstore"
)
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"testing"
"time"

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

Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"math"
"sort"

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

"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/storage/spanstore"
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/rw_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
"time"

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

Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"time"

"github.com/dgraph-io/badger/v3"
"github.com/dgraph-io/badger/v4"
"github.com/gogo/protobuf/proto"

"github.com/jaegertracing/jaeger/model"
Expand Down

0 comments on commit f9e5eb8

Please sign in to comment.