-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bugs in DefaultEnsemblePlacementPolicy #1788
Conversation
- bookieInfoMap is not initialized and newEnsemble will throws BKNotEnoughBookiesException if diskWeightBasedPlacement is enabled - add test coverage for DefaultEnsemblePlacementPolicy with diskWeightBasedPlacement enabled
@@ -92,6 +94,9 @@ | |||
} | |||
newBookies.add(b); | |||
--ensembleSize; | |||
if (ensembleSize == 0) { | |||
return newBookies; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple return newBookies;
after the while loop should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be, but i just want to follow the existing code format here, like how it is dealt in else block
@@ -92,6 +94,9 @@ | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for weightedSelection.getNextRandom()
to return exactly the same one bookie which i.e. is already in the newBookies or excludeBookies thus resulting in the infinite loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getNextRandom should eventually return different bookie.
check the logic here - https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/WeightedRandomSelection.java#L149
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if all the bookies already in either in excludeBookies or in a newBookies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is check for this condition - https://github.com/apache/bookkeeper/pull/1788/files#diff-b8389e8cd72c81923a6c9aa82e119310L86
run bookkeeper-server replication tests |
Descriptions of the changes in this PR: - bookieInfoMap is not initialized and newEnsemble will throws BKNotEnoughBookiesException if diskWeightBasedPlacement is enabled - add test coverage for DefaultEnsemblePlacementPolicy with diskWeightBasedPlacement enabled Reviewers: Sijie Guo <sijie@apache.org>, Andrey Yegorov <None> This closes #1788 from reddycharan/defaultplacementfix (cherry picked from commit 398aa4c) Signed-off-by: Sijie Guo <sijie@apache.org>
Descriptions of the changes in this PR: - bookieInfoMap is not initialized and newEnsemble will throws BKNotEnoughBookiesException if diskWeightBasedPlacement is enabled - add test coverage for DefaultEnsemblePlacementPolicy with diskWeightBasedPlacement enabled Reviewers: Sijie Guo <sijie@apache.org>, Andrey Yegorov <None> This closes #1788 from reddycharan/defaultplacementfix (cherry picked from commit 398aa4c) Signed-off-by: Sijie Guo <sijie@apache.org>
Descriptions of the changes in this PR:
diskWeightBasedPlacement is enabled