fix(shell): disk_replica printer bug #508
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
disk_replica
command will crash due to the bug ofmulti_printer.add(std::move(disk_printer))
:https://github.com/XiaoMi/pegasus/blob/47cea6363e963eeeb166cbd1661c5636324bb8e4/src/shell/commands/disk_rebalance.cpp#L235-L251
it can only be executed after the
disk_printer
was created, in other word, It should be move out offor (const auto &disk_info : resp.disk_infos)
loop and infor (const auto &err_resp : err_resps)
loop which will create newdisk_printer
every time.Actually, It should be same with
disk_capacity
:https://github.com/XiaoMi/pegasus/blob/47cea6363e963eeeb166cbd1661c5636324bb8e4/src/shell/commands/disk_rebalance.cpp#L150-L169What is changed and how it works?
Check List
Tests
Related changes