[
https://issues.apache.org/jira/browse/HADOOP-20061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18138457#comment-18138457
]
ASF GitHub Bot commented on HADOOP-20061:
-----------------------------------------
LuciferYang opened a new pull request, #8925:
URL: https://github.com/apache/hadoop/pull/8925
### Description of PR
JIRA: https://issues.apache.org/jira/browse/HADOOP-20061
`hadoop fs -count -e file:///tmp` fails with `-count: Fatal internal error`
and a `NullPointerException` from `ContentSummary#toErasureCodingPolicy`. The
same happens on s3a, abfs, viewfs internal directories and WebHDFS against
servers older than 3.3.0, where the content summary has no erasure coding
policy. The NPE is not an `IOException`, so `FsShell` prints a stack trace and
skips the remaining paths.
`ls -e` had the same NPE, and HDFS-13661 made it report `FileSystem X does
not support Erasure Coding`. This patch makes `Count#processPath` report the
same message as an `IOException`, so the error is printed for that path, the
other paths are still processed, and the command exits with 1.
`FileSystemShell.md` now describes this.
### How was this patch tested?
Added `TestCount#processPathECPolicyNotSupported`: `-e` on a file system
whose content summary has no policy throws `IOException` with that message and
prints nothing. Without the fix it fails with the NPE.
### For code changes:
- [x] Does the title of this PR start with the corresponding JIRA issue id
(e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: Have the integration tests been executed and the
endpoint declared according to the connector-specific documentation?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
- [x] The PR includes the phrase "Contains content generated by Claude Opus".
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
Contains content generated by Claude Opus.
> hadoop fs -count -e fails with NullPointerException when the file system
> reports no erasure coding policy
> ---------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-20061
> URL: https://issues.apache.org/jira/browse/HADOOP-20061
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Reporter: Yang Jie
> Priority: Minor
>
> {{hadoop fs -count -e file:///tmp}} fails with "-count: Fatal internal error"
> and a NullPointerException from ContentSummary#toErasureCodingPolicy. The
> same happens on s3a://, abfs://, a viewfs internal directory, and WebHDFS
> against a server older than 3.3.0. The ContentSummary returned there has no
> erasure coding policy, and Count#processPath calls toErasureCodingPolicy()
> without checking. Because the NPE is not an IOException, FsShell prints a
> stack trace and skips the remaining paths.
> {{ls -e}} had the same NPE, and HDFS-13661 fixed it by reporting "FileSystem
> X does not support Erasure Coding". This change makes {{count -e}} report the
> same message as an IOException, so the error is printed for that path, the
> remaining paths are still processed, and the command exits with 1.
> FileSystemShell.md is updated to describe this.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]