[ 
https://issues.apache.org/jira/browse/HDDS-15212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chi-Hsuan Huang updated HDDS-15212:
-----------------------------------
    Description: 
Follow-up to HDDS-14043, which fixed {{ozone fs -ls -e}} 
{{UnsupportedOperationException}} by populating 
{{ContentSummary.getErasureCodingPolicy()}} on {{ofs://}} and {{o3fs://}}.

For a bucket root, OM GetFileStatus returns an {{OzoneFileStatus}} without 
{{keyInfo}}. The client decodes it as a synthetic RATIS/ONE key, so 
{{toFileStatusAdapter}} reports an empty EC policy even when the bucket's 
default replication is EC. Only the volume listing path 
({{BasicRootedOzoneClientAdapterImpl#getFileStatusAdapterForBucket}}) reads 
{{ozoneBucket.getReplicationConfig()}}.

||Operation||Reports EC scheme for EC bucket?||
|{{fs.listStatus(volumePath)}} (each bucket entry)|Yes, {{isErasureCoded()}} is 
true|
|{{fs.getFileStatus(bucketPath)}}|No|
|{{fs.getContentSummary(bucketPath)}}|No, reports ""|

User-visible symptom: both shell commands go through 
{{getContentSummary(bucketPath)}}, so neither shows the EC scheme of an EC 
bucket.
* {{ozone fs -count -e /vol1/ecbucket1/}} prints {{EC:}} with an empty policy, 
same as for a RATIS bucket.
* {{ozone fs -ls -e /vol1/}} prints no EC column for the bucket entries either. 
Hadoop's {{Ls}} calls {{getContentSummary(item.path)}} for each listed entry 
instead of using the listed status.

The same gap exists in the o3fs adapter ({{BasicOzoneClientAdapterImpl}}), 
where {{fs.getContentSummary(new Path("/"))}} hits the same path.

h2. Suggested fix

Since HDDS-15925, OFS {{getFileStatus}} no longer fetches the bucket, so 
filling the policy in there would add an InfoBucket RPC to every bucket root 
{{getFileStatus}}. Instead:
* OFS: in {{BasicRootedOzoneFileSystem#getContentSummary}}, when the path is a 
bucket, take the EC policy from the bucket's default replication config. That 
is one InfoBucket per bucket summary, small next to the recursive listing it 
already does.
* o3fs: the adapter already holds the bucket, so 
{{BasicOzoneClientAdapterImpl#getFileStatus}} can fill in the policy for the 
root without an extra RPC.

Don't substitute {{getFileStatusAdapterForBucket}} wholesale, because it 
derives owner/group/modification-time differently from the regular keyInfo path 
and that would silently change visible metadata on bucket paths.

h2. Test coverage

* New test in {{AbstractRootedOzoneFileSystemTest}}: create an EC-configured 
bucket, assert {{fs.getContentSummary(bucketPath).getErasureCodingPolicy()}} 
returns the EC scheme name. This assertion was prototyped during HDDS-14043 
review and removed when the gap was identified, see 
[https://github.com/apache/ozone/pull/10209|https://github.com/apache/ozone/pull/10209].
* Parallel test in {{AbstractOzoneFileSystemTest}} for the {{o3fs://}} root.


  was:
Follow\-up to HDDS\-14043, which fixed {{ozone fs \-ls \-e}} 
{{UnsupportedOperationException}} by populating 
{{ContentSummary.getErasureCodingPolicy\(\)}} on {{ofs://}} and {{o3fs://}}.

That PR also fixed the synthetic\-bucket\-adapter 
\({{BasicRootedOzoneClientAdapterImpl#getFileStatusAdapterForBucket}}\) so that 
when _listing_ a volume, each EC\-configured bucket entry reports its EC scheme 
name. However, the parallel direct\-query path is not aligned:

||Operation||Reports EC scheme for EC bucket?||Why||
|{{fs.listStatus\(volumePath\)}} \(each bucket entry\)|Yes|Goes through 
{{getFileStatusAdapterForBucket\(bucket, uri\)}}, which reads 
{{ozoneBucket.getReplicationConfig\(\)}} directly.|
|{{fs.getFileStatus\(bucketPath\)}}|_No — reports ""_|Goes through 
{{getFileStatusForKeyOrSnapshot}} → {{bucket.getFileStatus\(""\)}} → regular 
{{toFileStatusAdapter}}, which reads the synthesized {{OmKeyInfo}}'s 
replication config \(OM defaults to RATIS, does not propagate the bucket's 
default EC config\).|
|{{fs.getContentSummary\(bucketPath\)}}|_No — reports ""_|Same path as above.|

User\-visible symptom: {{ozone fs \-count \-e /vol1/ecbucket1/}} reports an 
empty EC policy column for an EC\-configured bucket, even though {{ozone fs 
\-ls \-e /vol1/}} lists the same bucket with its scheme.

The same gap exists in the o3fs \(non\-rooted\) adapter 
\({{BasicOzoneClientAdapterImpl}}\), where {{o3fs://}} mounts a single bucket 
and {{fs.getFileStatus\(new Path\("/"\)\)}} hits the same synthetic\-keyInfo 
path.

h2. Suggested fix

Detect {{key.isEmpty\(\)}} \(i.e. the request is for the bucket directory 
itself\) in:

* {{BasicRootedOzoneClientAdapterImpl#getFileStatusForKeyOrSnapshot}}
* {{BasicOzoneClientAdapterImpl#getFileStatus}}

When the bucket has an EC default replication config, override the {{ecPolicy}} 
field on the resulting {{FileStatusAdapter}} with 
{{bucket.getReplicationConfig\(\).getReplication\(\)}}. Cleanest approach: an 
overload of {{toFileStatusAdapter\(..., String ecPolicyOverride\)}} that uses 
the override when non\-null. Don't substitute {{getFileStatusAdapterForBucket}} 
wholesale, because it derives owner/group/modification\-time differently from 
the regular keyInfo path and that would silently change visible metadata on 
bucket paths.

h2. Test coverage

* New test in {{AbstractRootedOzoneFileSystemTest}}: create an EC\-configured 
bucket, assert 
{{fs.getContentSummary\(bucketPath\).getErasureCodingPolicy\(\)}} returns the 
EC scheme name. This assertion was prototyped during HDDS\-14043 review and 
removed when the gap was identified — see 
[https://github.com/apache/ozone/pull/10209|https://github.com/apache/ozone/pull/10209].
* Parallel test in {{AbstractOzoneFileSystemTest}} for the {{o3fs://}} root.




> Align getFileStatus(bucketPath) with listStatus(volumePath) for EC bucket root
> ------------------------------------------------------------------------------
>
>                 Key: HDDS-15212
>                 URL: https://issues.apache.org/jira/browse/HDDS-15212
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Chi-Hsuan Huang
>            Assignee: Chi-Hsuan Huang
>            Priority: Minor
>
> Follow-up to HDDS-14043, which fixed {{ozone fs -ls -e}} 
> {{UnsupportedOperationException}} by populating 
> {{ContentSummary.getErasureCodingPolicy()}} on {{ofs://}} and {{o3fs://}}.
> For a bucket root, OM GetFileStatus returns an {{OzoneFileStatus}} without 
> {{keyInfo}}. The client decodes it as a synthetic RATIS/ONE key, so 
> {{toFileStatusAdapter}} reports an empty EC policy even when the bucket's 
> default replication is EC. Only the volume listing path 
> ({{BasicRootedOzoneClientAdapterImpl#getFileStatusAdapterForBucket}}) reads 
> {{ozoneBucket.getReplicationConfig()}}.
> ||Operation||Reports EC scheme for EC bucket?||
> |{{fs.listStatus(volumePath)}} (each bucket entry)|Yes, {{isErasureCoded()}} 
> is true|
> |{{fs.getFileStatus(bucketPath)}}|No|
> |{{fs.getContentSummary(bucketPath)}}|No, reports ""|
> User-visible symptom: both shell commands go through 
> {{getContentSummary(bucketPath)}}, so neither shows the EC scheme of an EC 
> bucket.
> * {{ozone fs -count -e /vol1/ecbucket1/}} prints {{EC:}} with an empty 
> policy, same as for a RATIS bucket.
> * {{ozone fs -ls -e /vol1/}} prints no EC column for the bucket entries 
> either. Hadoop's {{Ls}} calls {{getContentSummary(item.path)}} for each 
> listed entry instead of using the listed status.
> The same gap exists in the o3fs adapter ({{BasicOzoneClientAdapterImpl}}), 
> where {{fs.getContentSummary(new Path("/"))}} hits the same path.
> h2. Suggested fix
> Since HDDS-15925, OFS {{getFileStatus}} no longer fetches the bucket, so 
> filling the policy in there would add an InfoBucket RPC to every bucket root 
> {{getFileStatus}}. Instead:
> * OFS: in {{BasicRootedOzoneFileSystem#getContentSummary}}, when the path is 
> a bucket, take the EC policy from the bucket's default replication config. 
> That is one InfoBucket per bucket summary, small next to the recursive 
> listing it already does.
> * o3fs: the adapter already holds the bucket, so 
> {{BasicOzoneClientAdapterImpl#getFileStatus}} can fill in the policy for the 
> root without an extra RPC.
> Don't substitute {{getFileStatusAdapterForBucket}} wholesale, because it 
> derives owner/group/modification-time differently from the regular keyInfo 
> path and that would silently change visible metadata on bucket paths.
> h2. Test coverage
> * New test in {{AbstractRootedOzoneFileSystemTest}}: create an EC-configured 
> bucket, assert {{fs.getContentSummary(bucketPath).getErasureCodingPolicy()}} 
> returns the EC scheme name. This assertion was prototyped during HDDS-14043 
> review and removed when the gap was identified, see 
> [https://github.com/apache/ozone/pull/10209|https://github.com/apache/ozone/pull/10209].
> * Parallel test in {{AbstractOzoneFileSystemTest}} for the {{o3fs://}} root.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to