Skip to content

Commit f9dc914

Browse files
committed
feat: update deps and remove static vbucket count which is 1024
1 parent c67ceac commit f9dc914

File tree

18 files changed

+472
-513
lines changed

18 files changed

+472
-513
lines changed

couchbase/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,11 @@ func (s *client) GetVBucketSeqNos(awareCollection bool) (*wrapper.ConcurrentSwis
481481
return nil, err
482482
}
483483

484+
vBuckets := s.GetNumVBuckets()
485+
484486
eg := errgroup.Group{}
485487

486-
seqNos := wrapper.CreateConcurrentSwissMap[uint16, uint64](1024)
488+
seqNos := wrapper.CreateConcurrentSwissMap[uint16, uint64](uint64(vBuckets))
487489

488490
hasCollectionSupport := awareCollection && s.dcpAgent.HasCollectionsSupport()
489491

couchbase/metadata.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ func (s *cbMetadata) Load(
6969
vbIds []uint16,
7070
bucketUUID string,
7171
) (*wrapper.ConcurrentSwissMap[uint16, *models.CheckpointDocument], bool, error) {
72-
state := wrapper.CreateConcurrentSwissMap[uint16, *models.CheckpointDocument](1024)
72+
vBuckets := s.client.GetNumVBuckets()
73+
74+
state := wrapper.CreateConcurrentSwissMap[uint16, *models.CheckpointDocument](uint64(vBuckets))
7375

7476
wg := &sync.WaitGroup{}
7577
wg.Add(len(vbIds))

couchbase/rollback_mitigation.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ func (r *rollbackMitigation) markAbsentInstances() error { //nolint:unused
197197
}
198198

199199
func (r *rollbackMitigation) startObserve(groupID int) {
200-
r.vbUUIDMap = wrapper.CreateConcurrentSwissMap[uint16, gocbcore.VbUUID](1024)
200+
vBuckets := r.client.GetNumVBuckets()
201+
202+
r.vbUUIDMap = wrapper.CreateConcurrentSwissMap[uint16, gocbcore.VbUUID](uint64(vBuckets))
201203

202204
r.loadVbUUIDMap()
203205

@@ -353,13 +355,14 @@ func (r *rollbackMitigation) observe(vbID uint16, replica int, groupID int, vbUU
353355
}
354356

355357
func (r *rollbackMitigation) reset() {
358+
vBuckets := r.client.GetNumVBuckets()
356359
replicas, err := r.configSnapshot.NumReplicas()
357360
if err != nil {
358361
logger.Log.Error("error while reset rollback mitigation, err: %v", err)
359362
panic(err)
360363
}
361364

362-
r.persistedSeqNos = wrapper.CreateConcurrentSwissMap[uint16, []*vbUUIDAndSeqNo](1024)
365+
r.persistedSeqNos = wrapper.CreateConcurrentSwissMap[uint16, []*vbUUIDAndSeqNo](uint64(vBuckets))
363366

364367
var observeCount int
365368
for _, vbID := range r.vbIds {

dcp.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ func (s *dcp) membershipChangedListener(_ *membership.Model) {
9292

9393
//nolint:funlen
9494
func (s *dcp) Start() {
95+
vBuckets := s.client.GetNumVBuckets()
96+
9597
if s.metadata == nil {
9698
switch {
9799
case s.config.IsCouchbaseMetadata():
98100
s.metadata = couchbase.NewCBMetadata(s.client, s.config)
99101
case s.config.IsFileMetadata():
100-
s.metadata = metadata.NewFSMetadata(s.config)
102+
s.metadata = metadata.NewFSMetadata(s.config, vBuckets)
101103
case s.config.IsNoopMetadata():
102-
s.metadata = metadata.NewNoopMetadata(s.config)
104+
s.metadata = metadata.NewNoopMetadata(s.config, vBuckets)
103105
default:
104106
err := errors.New("invalid metadata type")
105107
logger.Log.Error("error while dcp start, err: %v", err)
@@ -113,8 +115,6 @@ func (s *dcp) Start() {
113115

114116
logger.Log.Info("using %v metadata", reflect.TypeOf(s.metadata))
115117

116-
vBuckets := s.client.GetNumVBuckets()
117-
118118
s.vBucketDiscovery = stream.NewVBucketDiscovery(s.client, s.config, vBuckets, s.bus)
119119

120120
tc := tracing.NewTracerComponent()

example/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ logging:
77
level: info
88
dcp:
99
group:
10-
name: groupName
10+
name: groupName

example/go.mod

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,64 @@ require github.com/Trendyol/go-dcp v0.0.0
1010

1111
require (
1212
github.com/andybalholm/brotli v1.2.0 // indirect
13-
github.com/ansrivas/fiberprometheus/v2 v2.13.0 // indirect
13+
github.com/ansrivas/fiberprometheus/v2 v2.17.0 // indirect
1414
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect
1515
github.com/beorn7/perks v1.0.1 // indirect
16-
github.com/bytedance/sonic v1.14.0 // indirect
17-
github.com/bytedance/sonic/loader v0.3.0 // indirect
16+
github.com/bytedance/gopkg v0.1.3 // indirect
17+
github.com/bytedance/sonic v1.15.0 // indirect
18+
github.com/bytedance/sonic/loader v0.5.0 // indirect
1819
github.com/cespare/xxhash/v2 v2.3.0 // indirect
19-
github.com/cloudwego/base64x v0.1.5 // indirect
20-
github.com/couchbase/gocbcore/v10 v10.7.1 // indirect
20+
github.com/cloudwego/base64x v0.1.6 // indirect
21+
github.com/couchbase/gocbcore/v10 v10.9.0 // indirect
2122
github.com/davecgh/go-spew v1.1.1 // indirect
2223
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
23-
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
24+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2425
github.com/go-logr/logr v1.4.3 // indirect
2526
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2627
github.com/go-openapi/jsonreference v0.20.2 // indirect
2728
github.com/go-openapi/swag v0.23.0 // indirect
28-
github.com/gofiber/fiber/v2 v2.52.9 // indirect
29+
github.com/gofiber/fiber/v2 v2.52.12 // indirect
2930
github.com/gogo/protobuf v1.3.2 // indirect
30-
github.com/golang/snappy v0.0.4 // indirect
31+
github.com/golang/snappy v1.0.0 // indirect
3132
github.com/google/gnostic-models v0.6.9 // indirect
3233
github.com/google/go-cmp v0.7.0 // indirect
3334
github.com/google/uuid v1.6.0 // indirect
3435
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
3536
github.com/josharian/intern v1.0.0 // indirect
3637
github.com/json-iterator/go v1.1.12 // indirect
37-
github.com/klauspost/compress v1.18.0 // indirect
38-
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
38+
github.com/klauspost/compress v1.18.4 // indirect
39+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
3940
github.com/mailru/easyjson v0.7.7 // indirect
40-
github.com/mattn/go-colorable v0.1.13 // indirect
41+
github.com/mattn/go-colorable v0.1.14 // indirect
4142
github.com/mattn/go-isatty v0.0.20 // indirect
4243
github.com/mattn/go-runewidth v0.0.16 // indirect
43-
github.com/mhmtszr/concurrent-swiss-map v1.0.8 // indirect
44+
github.com/mhmtszr/concurrent-swiss-map v1.0.9 // indirect
4445
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4546
github.com/modern-go/reflect2 v1.0.2 // indirect
4647
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4748
github.com/pkg/errors v0.9.1 // indirect
48-
github.com/prometheus/client_golang v1.22.0 // indirect
49-
github.com/prometheus/client_model v0.6.1 // indirect
50-
github.com/prometheus/common v0.62.0 // indirect
51-
github.com/prometheus/procfs v0.15.1 // indirect
49+
github.com/prometheus/client_golang v1.23.2 // indirect
50+
github.com/prometheus/client_model v0.6.2 // indirect
51+
github.com/prometheus/common v0.66.1 // indirect
52+
github.com/prometheus/procfs v0.16.1 // indirect
5253
github.com/rivo/uniseg v0.4.7 // indirect
53-
github.com/sirupsen/logrus v1.9.3 // indirect
54+
github.com/sirupsen/logrus v1.9.4 // indirect
5455
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
5556
github.com/valyala/bytebufferpool v1.0.0 // indirect
56-
github.com/valyala/fasthttp v1.64.0 // indirect
57+
github.com/valyala/fasthttp v1.69.0 // indirect
5758
github.com/x448/float16 v0.8.4 // indirect
58-
go.opentelemetry.io/otel v1.37.0 // indirect
59-
go.opentelemetry.io/otel/trace v1.37.0 // indirect
59+
go.opentelemetry.io/otel v1.40.0 // indirect
60+
go.opentelemetry.io/otel/trace v1.40.0 // indirect
61+
go.yaml.in/yaml/v2 v2.4.2 // indirect
6062
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
61-
golang.org/x/net v0.42.0 // indirect
62-
golang.org/x/oauth2 v0.27.0 // indirect
63-
golang.org/x/sync v0.16.0 // indirect
64-
golang.org/x/sys v0.34.0 // indirect
65-
golang.org/x/term v0.33.0 // indirect
66-
golang.org/x/text v0.27.0 // indirect
63+
golang.org/x/net v0.50.0 // indirect
64+
golang.org/x/oauth2 v0.30.0 // indirect
65+
golang.org/x/sync v0.19.0 // indirect
66+
golang.org/x/sys v0.41.0 // indirect
67+
golang.org/x/term v0.40.0 // indirect
68+
golang.org/x/text v0.34.0 // indirect
6769
golang.org/x/time v0.9.0 // indirect
68-
google.golang.org/protobuf v1.36.5 // indirect
70+
google.golang.org/protobuf v1.36.8 // indirect
6971
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
7072
gopkg.in/inf.v0 v0.9.1 // indirect
7173
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)