Skip to content

Commit 62c138e

Browse files
committed
rebalancer: add replicaset.id into rebalancer_request_state errors
Before this patch the function `rebalancer_download_states` didn't return information about replicaset from which the states could not be downloaded. As a result, the errors returned from `rebalancer_download_states` lack of valuable information about unhealthy replicaset. Now, we add replicaset.id into error which is returned from the `rebalancer_download_states`. It can help us to propagate replicaset.id to rebalancer service. Closes #212 NO_DOC=bugfix
1 parent 9d69cc6 commit 62c138e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

test/storage-luatest/storage_1_1_1_test.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,21 @@ test_group.test_rebalancer_routes_logging = function(g)
227227
g.replica_1_a:grep_log('The cluster is balanced ok.')
228228
end)
229229
end
230+
231+
--
232+
-- Add replicaset.id into rebalancer_request_state errors (gh-212).
233+
--
234+
test_group.test_no_log_spam_when_buckets_no_active = function(g)
235+
local moved_bucket = vtest.storage_first_bucket(g.replica_1_a)
236+
move_bucket(g.replica_1_a, g.replica_2_a, moved_bucket)
237+
vtest.storage_stop(g.replica_2_a)
238+
local err_log = string.format('Error during downloading rebalancer ' ..
239+
'states:.*"replicaset_id":"%s"',
240+
g.replica_2_a:replicaset_uuid())
241+
t.helpers.retrying({timeout = 60}, function()
242+
g.replica_1_a:exec(function() ivshard.storage.rebalancer_wakeup() end)
243+
t.assert(g.replica_1_a:grep_log(err_log))
244+
end)
245+
vtest.storage_start(g.replica_2_a, global_cfg)
246+
move_bucket(g.replica_2_a, g.replica_1_a, moved_bucket)
247+
end

vshard/storage/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,6 +2812,7 @@ local function rebalancer_download_states()
28122812
replicaset, 'vshard.storage.rebalancer_request_state', {},
28132813
{timeout = consts.REBALANCER_GET_STATE_TIMEOUT})
28142814
if state == nil then
2815+
err.replicaset_id = replicaset.id
28152816
return nil, err
28162817
end
28172818
local bucket_count = state.bucket_active_count +

0 commit comments

Comments
 (0)