-
Notifications
You must be signed in to change notification settings - Fork 275
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
Make CompositeClusterManager more robust to NPEs and other errors #1164
Conversation
- Handle equality checks correctly for methods that can return null. - Catch checked exceptions that HelixClusterManager may throw. This ensures that StaticClusterManager acts as the source of truth and failures in HelixClusterManager will not affect CompositeClusterManager's operation.
@@ -31,6 +34,7 @@ | |||
* and reports inconsistencies in the views from the two underlying cluster managers. | |||
*/ | |||
class CompositeClusterManager implements ClusterMap { | |||
private static final Logger LOGGER = LoggerFactory.getLogger(CompositeClusterManager.class); | |||
final StaticClusterManager staticClusterManager; | |||
final HelixClusterManager helixClusterManager; | |||
final HelixClusterManagerMetrics helixClusterManagerMetrics; |
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.
Let's add strict check for both helixClusterManager
and helixClusterManagerMetrics
. That is, check if they are null
in all places where dereference is invoked.
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.
After fixing the constructor, all places where these are used are surrounded by a null check.
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.
Will approve after single comment is addressed.
Codecov Report
@@ Coverage Diff @@
## master #1164 +/- ##
============================================
- Coverage 69.79% 69.71% -0.08%
+ Complexity 5328 5326 -2
============================================
Files 425 425
Lines 32644 32652 +8
Branches 4147 4148 +1
============================================
- Hits 22784 22764 -20
- Misses 8723 8747 +24
- Partials 1137 1141 +4
Continue to review full report at Codecov.
|
ensures that StaticClusterManager acts as the source of truth and
failures in HelixClusterManager will not affect
CompositeClusterManager's operation.