Skip to content

Commit 830cc3c

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

File tree

18 files changed

+507
-523
lines changed

18 files changed

+507
-523
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
hosts:
2-
- localhost:8091
3-
username: user
4-
password: 123456
2+
- localhost:6379
53
bucketName: dcp-test
64
logging:
75
level: info
86
dcp:
97
group:
108
name: groupName
9+
membership:
10+
rebalanceDelay: 1s

example/go.mod

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,80 @@
11
module example
22

3-
go 1.24.0
4-
5-
toolchain go1.24.5
3+
go 1.25.0
64

75
replace github.com/Trendyol/go-dcp => ../.
86

7+
replace github.com/couchbase/gocbcore/v10 => ../../../CLionProjects/redis-hyrat/packages/gohyratcore
8+
99
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
23+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
2224
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
23-
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
25+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2426
github.com/go-logr/logr v1.4.3 // indirect
2527
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2628
github.com/go-openapi/jsonreference v0.20.2 // indirect
2729
github.com/go-openapi/swag v0.23.0 // indirect
28-
github.com/gofiber/fiber/v2 v2.52.9 // indirect
30+
github.com/gofiber/fiber/v2 v2.52.12 // indirect
31+
github.com/gofiber/fiber/v3 v3.1.0 // indirect
32+
github.com/gofiber/schema v1.7.0 // indirect
33+
github.com/gofiber/utils/v2 v2.0.2 // indirect
2934
github.com/gogo/protobuf v1.3.2 // indirect
30-
github.com/golang/snappy v0.0.4 // indirect
3135
github.com/google/gnostic-models v0.6.9 // indirect
3236
github.com/google/go-cmp v0.7.0 // indirect
3337
github.com/google/uuid v1.6.0 // indirect
34-
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
3538
github.com/josharian/intern v1.0.0 // indirect
3639
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
40+
github.com/klauspost/compress v1.18.4 // indirect
41+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
3942
github.com/mailru/easyjson v0.7.7 // indirect
40-
github.com/mattn/go-colorable v0.1.13 // indirect
43+
github.com/mattn/go-colorable v0.1.14 // indirect
4144
github.com/mattn/go-isatty v0.0.20 // indirect
4245
github.com/mattn/go-runewidth v0.0.16 // indirect
43-
github.com/mhmtszr/concurrent-swiss-map v1.0.8 // indirect
46+
github.com/mhmtszr/concurrent-swiss-map v1.0.9 // indirect
4447
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4548
github.com/modern-go/reflect2 v1.0.2 // indirect
4649
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
50+
github.com/philhofer/fwd v1.2.0 // indirect
4751
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
52+
github.com/prometheus/client_golang v1.23.2 // indirect
53+
github.com/prometheus/client_model v0.6.2 // indirect
54+
github.com/prometheus/common v0.66.1 // indirect
55+
github.com/prometheus/procfs v0.16.1 // indirect
56+
github.com/redis/go-redis/v9 v9.18.0 // indirect
5257
github.com/rivo/uniseg v0.4.7 // indirect
53-
github.com/sirupsen/logrus v1.9.3 // indirect
58+
github.com/sirupsen/logrus v1.9.4 // indirect
59+
github.com/tinylib/msgp v1.6.3 // indirect
5460
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
5561
github.com/valyala/bytebufferpool v1.0.0 // indirect
56-
github.com/valyala/fasthttp v1.64.0 // indirect
62+
github.com/valyala/fasthttp v1.69.0 // indirect
5763
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
64+
go.opentelemetry.io/otel v1.40.0 // indirect
65+
go.opentelemetry.io/otel/trace v1.40.0 // indirect
66+
go.uber.org/atomic v1.11.0 // indirect
67+
go.yaml.in/yaml/v2 v2.4.2 // indirect
6068
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
69+
golang.org/x/crypto v0.48.0 // indirect
70+
golang.org/x/net v0.50.0 // indirect
71+
golang.org/x/oauth2 v0.30.0 // indirect
72+
golang.org/x/sync v0.19.0 // indirect
73+
golang.org/x/sys v0.41.0 // indirect
74+
golang.org/x/term v0.40.0 // indirect
75+
golang.org/x/text v0.34.0 // indirect
6776
golang.org/x/time v0.9.0 // indirect
68-
google.golang.org/protobuf v1.36.5 // indirect
77+
google.golang.org/protobuf v1.36.8 // indirect
6978
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
7079
gopkg.in/inf.v0 v0.9.1 // indirect
7180
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)