Chi-Hsuan Huang created HDDS-16375:
--------------------------------------

             Summary: Recon fileCount API silently ignores the fileSize 
parameter unless volume and bucket are both set
                 Key: HDDS-16375
                 URL: https://issues.apache.org/jira/browse/HDDS-16375
             Project: Apache Ozone
          Issue Type: Bug
          Components: Ozone Recon
            Reporter: Chi-Hsuan Huang


{{GET /api/v1/utilization/fileCount}} applies the {{fileSize}} filter only when 
{{volume}}, {{bucket}} and {{fileSize}} are all provided. Any other combination 
falls into the scan branch, which filters on volume and bucket only, so 
{{fileSize}} is dropped without an error or warning.

Measured on current master by calling {{UtilizationEndpoint#getFileCounts}} 
directly from {{TestEndpoints#testGetFileCounts}}. The dataset has 3 bins: 
{{vol1/bucket1:1024}}, {{vol1/bucket1:131072}}, {{vol2/bucket1:1024}}.

{noformat}
getFileCounts\(null, null, 131072\)   \-> 3 results: \[vol1/bucket1:1024, 
vol1/bucket1:131072, vol2/bucket1:1024\]
getFileCounts\("vol1", null, 131072\) \-> 2 results: \[vol1/bucket1:1024, 
vol1/bucket1:131072\]
{noformat}

Both should return a single bin. The responses include bins that do not match 
the requested size, so the caller receives an unfiltered list that looks like a 
filtered one.

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 matters more now that the Recon chatbot \(HDDS\-14816, HDDS\-15570\) 
registers this endpoint as an LLM tool and advertises {{fileSize}} as a 
parameter in {{LlmToolSpecFactory}}. A model answering "how many files around 
1MB are there" will pass {{fileSize}} on its own and present the full 
distribution as a filtered answer.

Two ways to resolve this, and the choice needs a maintainer call:h1. Apply the 
{{fileSize}} filter independently in the scan branch, matching the documented 
behaviour.
h1. Keep the current parameter hierarchy and update ReconApi.md to state that 
{{fileSize}} requires {{volume}} and {{bucket}}.
This is pre\-existing and dates back to HDDS\-3681. HDDS\-16357 fixed a 
separate normalization bug in the same method and does not overlap with this.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to