HDDS-2467. Allow running Freon validators with limited memory #152
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?
byte[]buffer. This allows timing only the read (and buffer allocation), but not the subsequent digest calculation. However, it also means that memory required for running the validators is proportional to key size. I propose to add a command-line flag (-s/--stream) which, when specified, makes Freon calculate the digest while reading the input stream. This changes timing results a bit, since values will include the time required for digest calculation. On the other hand, Freon will be able to validate huge keys with limited memory.ByteArrayOutputStream, which allocates incrementally larger and larger buffers. The latter can lead to memory requirement twice the actual key size in the worst case (since2^n > 2^n-1 + 2^n-2 + ...).SameKeyReaderandOzoneClientKeyValidator.OzoneClientKeyGeneratorto create > 2GB keys.https://issues.apache.org/jira/browse/HDDS-2467
How was this patch tested?
Created and validated keys using Freon. Verified that even 2.5GB key can be created and validated with
--stream. Verified that streaming is forced for such a large key, since it won't fit any array. Verified that smaller keys can be validated both ways.