Skip to content
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

Merged
merged 2 commits into from
May 1, 2019

Conversation

cgtz
Copy link
Contributor

@cgtz cgtz commented May 1, 2019

  • 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.

- 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.
@cgtz cgtz requested review from jsjtzyy and pnarayanan May 1, 2019 21:10
@@ -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;
Copy link
Contributor

@jsjtzyy jsjtzyy May 1, 2019

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@jsjtzyy jsjtzyy left a 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-io
Copy link

codecov-io commented May 1, 2019

Codecov Report

Merging #1164 into master will decrease coverage by 0.07%.
The diff coverage is 38.46%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...thub.ambry.clustermap/CompositeClusterManager.java 66.12% <38.46%> (-1.12%) 20 <1> (+1)
...b.ambry.network/BlockingChannelConnectionPool.java 66.22% <0%> (-3.08%) 8% <0%> (ø)
...java/com.github.ambry.network/BlockingChannel.java 78.87% <0%> (-2.82%) 9% <0%> (-1%)
...github.ambry.rest/AsyncRequestResponseHandler.java 88.59% <0%> (-2.29%) 23% <0%> (ø)
....github.ambry.protocol/ReplicaMetadataRequest.java 76.08% <0%> (-2.18%) 14% <0%> (-1%)
...va/com.github.ambry.replication/ReplicaThread.java 73.95% <0%> (-1.6%) 61% <0%> (-2%)
...in/java/com.github.ambry.store/BlobStoreStats.java 71.13% <0%> (-0.62%) 103% <0%> (ø)
...java/com.github.ambry.network/SSLTransmission.java 69.74% <0%> (+0.31%) 69% <0%> (+1%) ⬆️
...in/java/com.github.ambry.clustermap/Partition.java 80.45% <0%> (+3.44%) 26% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee10484...4dc7176. Read the comment docs.

@jsjtzyy jsjtzyy merged commit f9eee53 into linkedin:master May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants