Skip to content

HDDS-16375. Apply fileSize filter independently in Recon fileCount endpoint - #11203

Open
ermahesh wants to merge 3 commits into
apache:masterfrom
ermahesh:HDDS-16375
Open

HDDS-16375. Apply fileSize filter independently in Recon fileCount endpoint#11203
ermahesh wants to merge 3 commits into
apache:masterfrom
ermahesh:HDDS-16375

Conversation

@ermahesh

@ermahesh ermahesh commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

ReconApi.md lists fileSize as optional and describes it as "Filters the
results 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 fileSize filter 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#testGetFileCounts with the four parameter combinations
that were previously uncovered: fileSize alone, volume + fileSize,
bucket + fileSize, and a fileSize that is not a bin upper bound with no
volume 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-branch workflow run on the fork.

…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.
@ermahesh ermahesh changed the title Hdds 16375 HDDS-16375 : Apply fileSize filter independently in Recon fileCount endpoint Sep 4, 2026
@ermahesh ermahesh changed the title HDDS-16375 : Apply fileSize filter independently in Recon fileCount endpoint HDDS-16375. Apply fileSize filter independently in Recon fileCount endpoint Sep 5, 2026

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! @ermahesh +1 LGTM.

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.

2 participants