From 8b8f555ee2bbaea443cf4dde32ee283efdd32190 Mon Sep 17 00:00:00 2001 From: Vladimir Severov Date: Mon, 15 Apr 2024 18:44:46 +0400 Subject: [PATCH] Fix buckets discovery The `vshard.storage.buckets_discovery` function does not return the `next_from` field if the response does not contain a full batch of buckets. Therefore, if there is no `next_from`, then this means that discovery has ended. --- CHANGELOG.md | 9 ++++++++- discovery.go | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8044e9..d89eec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ +## Unreleased + +BUG FIXES: + +* Fix buckets discovery (it doesn't freeze now) + ## 0.0.11 FEATURES: + * BucketStat has become a public method (#21) REFACTOR: @@ -23,4 +30,4 @@ FEATURES: REFACTOR: -* refactored place for rs method \ No newline at end of file +* refactored place for rs method diff --git a/discovery.go b/discovery.go index 71e5da5..727ec27 100644 --- a/discovery.go +++ b/discovery.go @@ -203,8 +203,9 @@ func (r *Router) DiscoveryAllBuckets(ctx context.Context) error { knownBucket.Add(1) } - // if TotalBucketCount < BUCKET_CHUNK_SIZE then nextFrom equal zero - if rawReq.From == *nextFrom { + // There are no more buckets + // https://github.com/tarantool/vshard/blob/8d299bfe/vshard/storage/init.lua#L1730 + if nextFrom == nil || *nextFrom == 0 { return nil }