Skip to content

Commit f9e5eb8

Browse files
authored
Upgrade Badger v3->Badger v4 (jaegertracing#5619)
## Which problem is this PR solving? - Resolves jaegertracing#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 <[email protected]>
1 parent 1830148 commit f9e5eb8

File tree

11 files changed

+19
-57
lines changed

11 files changed

+19
-57
lines changed

go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
1212
github.com/bsm/sarama-cluster v2.1.13+incompatible
1313
github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b
14-
github.com/dgraph-io/badger/v3 v3.2103.5
14+
github.com/dgraph-io/badger/v4 v4.2.0
1515
github.com/elastic/go-elasticsearch/v8 v8.14.0
1616
github.com/fsnotify/fsnotify v1.7.0
1717
github.com/go-logr/zapr v1.3.0
@@ -92,7 +92,6 @@ require (
9292
github.com/aws/aws-sdk-go v1.53.11 // indirect
9393
github.com/beorn7/perks v1.0.1 // indirect
9494
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
95-
github.com/cespare/xxhash v1.1.0 // indirect
9695
github.com/cespare/xxhash/v2 v2.3.0 // indirect
9796
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
9897
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect

go.sum

+2-39
Large diffs are not rendered by default.

plugin/storage/badger/factory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525
"time"
2626

27-
"github.com/dgraph-io/badger/v3"
27+
"github.com/dgraph-io/badger/v4"
2828
"github.com/spf13/viper"
2929
"go.uber.org/zap"
3030

plugin/storage/badger/factory_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func TestMaintenanceRun(t *testing.T) {
114114

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

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

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

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

172172
waiter := func(previousValue int64) int64 {
173173
sleeps := 0
174174
_, gs := mFactory.Snapshot()
175-
for gs["badger_v3_memtable_gets_total"] == previousValue && sleeps < 8 {
175+
for gs["badger_get_num_memtable"] == previousValue && sleeps < 8 {
176176
// Wait for the scheduler
177177
time.Sleep(time.Duration(50) * time.Millisecond)
178178
sleeps++
179179
_, gs = mFactory.Snapshot()
180180
}
181-
assert.Equal(t, gs["badger_v3_memtable_gets_total"], previousValue)
182-
return gs["badger_v3_memtable_gets_total"]
181+
assert.Equal(t, gs["badger_get_num_memtable"], previousValue)
182+
return gs["badger_get_num_memtable"]
183183
}
184184

185185
vlogSize := waiter(0)
186186
_, gs := mFactory.Snapshot()
187187
assert.EqualValues(t, 0, vlogSize)
188-
assert.EqualValues(t, int64(0), gs["badger_v3_memtable_gets_total"]) // IntVal metric
188+
assert.EqualValues(t, int64(0), gs["badger_get_num_memtable"]) // IntVal metric
189189

190-
_, found = gs["badger_v3_lsm_size_bytes"] // Map metric
190+
_, found = gs["badger_size_bytes_lsm"] // Map metric
191191
assert.True(t, found)
192192

193193
err := f.Close()

plugin/storage/badger/samplingstore/storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"encoding/json"
2121
"time"
2222

23-
"github.com/dgraph-io/badger/v3"
23+
"github.com/dgraph-io/badger/v4"
2424

2525
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
2626
jaegermodel "github.com/jaegertracing/jaeger/model"

plugin/storage/badger/samplingstore/storage_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"testing"
2020
"time"
2121

22-
"github.com/dgraph-io/badger/v3"
22+
"github.com/dgraph-io/badger/v4"
2323
"github.com/stretchr/testify/assert"
2424
"github.com/stretchr/testify/require"
2525

plugin/storage/badger/spanstore/cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"sync"
2020
"time"
2121

22-
"github.com/dgraph-io/badger/v3"
22+
"github.com/dgraph-io/badger/v4"
2323

2424
"github.com/jaegertracing/jaeger/storage/spanstore"
2525
)

plugin/storage/badger/spanstore/cache_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"testing"
1818
"time"
1919

20-
"github.com/dgraph-io/badger/v3"
20+
"github.com/dgraph-io/badger/v4"
2121
"github.com/stretchr/testify/assert"
2222
"github.com/stretchr/testify/require"
2323

plugin/storage/badger/spanstore/reader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"math"
2525
"sort"
2626

27-
"github.com/dgraph-io/badger/v3"
27+
"github.com/dgraph-io/badger/v4"
2828

2929
"github.com/jaegertracing/jaeger/model"
3030
"github.com/jaegertracing/jaeger/storage/spanstore"

plugin/storage/badger/spanstore/rw_internal_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"testing"
2121
"time"
2222

23-
"github.com/dgraph-io/badger/v3"
23+
"github.com/dgraph-io/badger/v4"
2424
"github.com/stretchr/testify/assert"
2525
"github.com/stretchr/testify/require"
2626

plugin/storage/badger/spanstore/writer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222
"time"
2323

24-
"github.com/dgraph-io/badger/v3"
24+
"github.com/dgraph-io/badger/v4"
2525
"github.com/gogo/protobuf/proto"
2626

2727
"github.com/jaegertracing/jaeger/model"

0 commit comments

Comments
 (0)