HDDS-2325. BenchMarkDatanodeDispatcher genesis test is failing with NPE #60
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 changes were proposed in this pull request?
TLDR; Fix BenchmarkDatanodeDispatcher.writeChunk test.
Genesis is a microbenchmark tool for Ozone based on JMH (https://openjdk.java.net/projects/code-tools/jmh/).
Due to the recent Datanode changes the BenchMarkDatanodeDispatcher is failing with NPE:
And this is the just the biggest problem there are a few other problems. I propose the following fixes:
fix 1: NPE is thrown because the 'context' object is required by KeyValueHandler/Handler classes.
In fact the context is not required, we need two functionalities/info from the context: the ability to send icr (IncrementalContainerReport) and the ID of the datanode.
Law of Demeter principle suggests to have only the minimum required information from other classes.
For example instead of having context but using only context.getParent().getDatanodeDetails().getUuidString() we can have only the UUID string which makes more easy to test (unit and benchmark) the Handler/KeyValueHandler.
This is the biggest (but still small change) in this patch: I started to use the datanodeId and an icrSender instead of having the full context.
fix 2,3: There were a few other problems. The scmId was missing if the writeChunk was called from Benchmark and and the Checksum was also missing.
fix 4: I also had a few other problems: very huge containers are used (default 5G) and as the benchmark starts with creating 100 containers it requires 500G space by default. I adjusted the container size to make it possible to run on local machine.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-2325
How was this patch tested?