When rebalancer downloads bucket states it can notice, that something is wrong with the cluster. But all it does is printing the message in logs:
|
log.info('Total active bucket count is not equal to total. '.. |
|
'Possibly a boostrap is not finished yet. Expected %d, but '.. |
|
'found %d', M.total_bucket_count, sum) |
However, users never care about logs until the real problem happens, but they care a lot about vshard alerts, which are pushed to cartridge/tcm.
I propose to push the alert to vshard.storage.info.alerts, if sum > M.total_bucket_count. It should go away automatically as soon as rebalancer notice, that sum is ok (note, that in case of rebalancer_download_states failure rebalancer starts to wake up every REBALANCER_WORK_INTERVAL (10 seconds), so pretty fast after cluster is fixed). It costs us nothing (one more bool variable in the memory) and will alert the user about possible catastrophe.
Note, that sum < M.total_bucket_count either mean, that we've lost some bucket (e.g. during cluster restore) or bootstrap is not finished, it'd be great, if we could distinguish these two cases, but there's no easy way to do so with the current code: we must set the persistent flag on storages, which indicates, that this storage is bootsrapped, and send that flag during vshard.storage.rebalancer_request_state to rebalancer. Though, I don't like introducing some logic for checking the situation which should never happen, if there're no bugs. So, no missing bucket alert for now.
When rebalancer downloads bucket states it can notice, that something is wrong with the cluster. But all it does is printing the message in logs:
vshard/vshard/storage/init.lua
Lines 2850 to 2852 in 7ccb617
However, users never care about logs until the real problem happens, but they care a lot about vshard alerts, which are pushed to cartridge/tcm.
I propose to push the alert to
vshard.storage.info.alerts, if sum > M.total_bucket_count. It should go away automatically as soon as rebalancer notice, that sum is ok (note, that in case ofrebalancer_download_statesfailure rebalancer starts to wake up everyREBALANCER_WORK_INTERVAL(10 seconds), so pretty fast after cluster is fixed). It costs us nothing (one more bool variable in the memory) and will alert the user about possible catastrophe.Note, that sum < M.total_bucket_count either mean, that we've lost some bucket (e.g. during cluster restore) or bootstrap is not finished, it'd be great, if we could distinguish these two cases, but there's no easy way to do so with the current code: we must set the persistent flag on storages, which indicates, that this storage is bootsrapped, and send that flag during
vshard.storage.rebalancer_request_stateto rebalancer. Though, I don't like introducing some logic for checking the situation which should never happen, if there're no bugs. So, no missing bucket alert for now.