HDDS-16375. Apply fileSize filter independently in Recon fileCount endpoint - #11203
Open
ermahesh wants to merge 3 commits into
Open
HDDS-16375. Apply fileSize filter independently in Recon fileCount endpoint#11203ermahesh wants to merge 3 commits into
ermahesh wants to merge 3 commits into
Conversation
…dpoint The scan branch of UtilizationEndpoint#getFileCounts filtered only on volume and bucket, so the fileSize query parameter was silently ignored for every combination except volume + bucket + fileSize. Callers got an unfiltered list that looked like a filtered one, with no error or warning. Apply the fileSize filter in the scan branch as well, matching the behaviour already documented in ReconApi.md. The comparison is against the exact bin upper bound, consistent with the point-get branch which uses the raw value as the RocksDB key.
…Counts under the method length limit The added filter coverage pushed testGetFileCounts to 162 lines, over the Checkstyle MethodLength default of 150. Move the endpoint query assertions, which were already a self-contained block, into a private helper. No change to what is asserted.
…an loop Long.valueOf(fileSize).equals(...) allocated a Long per scanned row for values outside the Integer cache, and went through equals(Object). Comparing the primitive fileSize against the unboxed bin upper bound is allocation-free. FileSizeCountKey#getFileSizeUpperBound is never null for keys decoded from the table, since fromProto reads a proto int64; the class's own equals and hashCode already rely on that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ReconApi.mdlistsfileSizeas optional and describes it as "Filters theresults based on the given fileSize", with no stated dependency on the other
two parameters. This patch makes the code match the documented behaviour by
applying the
fileSizefilter independently in the scan branch.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16375
How was this patch tested?
Extended
TestEndpoints#testGetFileCountswith the four parameter combinationsthat were previously uncovered:
fileSizealone,volume+fileSize,bucket+fileSize, and afileSizethat is not a bin upper bound with novolume or bucket. The first two reproduce the measurements above and fail
without the fix. The existing assertions for the other combinations are
unchanged.
Verified by a full
build-branchworkflow run on the fork.