Skip to content

Commit 9ed1a2b

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 fe15245 commit 9ed1a2b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/storage-luatest/storage_1_1_1_test.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,20 @@ rebalancer_recovery_group.test_rebalancer_routes_logging = function(g)
220220
g.replica_1_a:grep_log('The cluster is balanced ok.')
221221
end)
222222
end
223+
224+
rebalancer_recovery_group.test_no_log_spam_when_buckets_no_active = function(g)
225+
local moved_bucket = vtest.storage_first_bucket(g.replica_2_a)
226+
start_bucket_move(g.replica_1_a, g.replica_2_a, moved_bucket)
227+
wait_for_bucket_is_transferred(g.replica_1_a, g.replica_2_a, moved_bucket)
228+
vtest.storage_stop(g.replica_2_a)
229+
local buckets_not_active = string.format(
230+
'Error during downloading rebalancer states: {"replicaset_id":"%s"',
231+
g.replica_2_a:replicaset_uuid())
232+
t.helpers.retrying({timeout = 60}, function()
233+
g.replica_1_a:exec(function() ivshard.storage.rebalancer_wakeup() end)
234+
t.assert(g.replica_1_a:grep_log(buckets_not_active))
235+
end)
236+
vtest.storage_start(g.replica_2_a, global_cfg)
237+
start_bucket_move(g.replica_2_a, g.replica_1_a, moved_bucket)
238+
wait_for_bucket_is_transferred(g.replica_2_a, g.replica_1_a, moved_bucket)
239+
end

vshard/storage/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,6 +2806,7 @@ local function rebalancer_download_states()
28062806
replicaset, 'vshard.storage.rebalancer_request_state', {},
28072807
{timeout = consts.REBALANCER_GET_STATE_TIMEOUT})
28082808
if state == nil then
2809+
err.replicaset_id = replicaset.id
28092810
return nil, err
28102811
end
28112812
local bucket_count = state.bucket_active_count +

0 commit comments

Comments
 (0)