[
https://issues.apache.org/jira/browse/HADOOP-20005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18139275#comment-18139275
]
ASF GitHub Bot commented on HADOOP-20005:
-----------------------------------------
joseluisll opened a new pull request, #8947:
URL: https://github.com/apache/hadoop/pull/8947
### Description of PR
ImageServlet reported why it turned a transfer down only in the reason
phrase, set through a cast to Jetty's Response. The servlet closes its output
stream on the way out of every request, which commits the response before the
container can render an error page, so a container that sends no custom phrase
leaves the SecondaryNameNode or standby NameNode with a bare status code.
The servlet now writes the reason into the body itself and keeps the phrase
through setStatus(int, String), without the cast. Util#doGetUrl,
TransferFsImage's upload and EditLogFileInputStream read the body through
ResponseDetail before falling back to the phrase.
A refusal found inside a transfer reaches the servlet's own catch as well,
and finds the response committed. That second report is logged at DEBUG. No
change on Jetty 9.4: the reason is in both the phrase and the body.
Stacked on #8945 (HADOOP-20003): this branch carries that commit plus the
fsimage changes, and replaces it once it lands.
### How was this patch tested?
The changed modules' tests, run by the Yetus precommit and the fork's CI on
this branch.
### For code changes:
- [x] Does the title of this PR start with the corresponding JIRA issue id?
- [ ] Object storage: not applicable, no object store integration touched.
- [ ] If adding new dependencies to the code: not applicable, no new
dependency.
- [ ] If applicable, have you updated the LICENSE files: not applicable.
### AI Tooling
If an AI tool was used:
- [x] The PR includes the phrase "Contains content generated by <tool>"
where <tool> is the name of the AI tool used.
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
Contains content generated by Claude Code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
> Write a refused fsimage transfer's reason into the response body
> ----------------------------------------------------------------
>
> Key: HADOOP-20005
> URL: https://issues.apache.org/jira/browse/HADOOP-20005
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: hdfs
> Reporter: Jose Luis López
> Priority: Major
>
> When {{ImageServlet}} refuses a transfer, it reports why only in the reason
> phrase, set through a cast to Jetty's {{Response}}. The servlet closes its
> output stream on every request, which commits the response before the
> container can write an error page. On a container that sends no custom
> phrase, which is Jetty 12 (HADOOP-19972), the SecondaryNameNode or standby
> NameNode is left with a bare status code.
> h3. Changes
> * {{ImageServlet}} writes the reason into the body itself, so the reason no
> longer depends on how the container renders errors. It keeps the phrase
> through {{setStatus(int, String)}}, without the Jetty cast.
> * The three readers of a failed transfer read the body before falling back to
> the phrase: {{Util#doGetUrl}}, {{TransferFsImage}}'s upload, and
> {{EditLogFileInputStream}}. They use the reader added in HADOOP-20003.
> * A refusal that reaches the servlet's own catch block after the response is
> committed is logged at DEBUG rather than reported a second time.
> h3. Compatibility
> No change on Jetty 9.4. The reason is in both the phrase and the body.
> h3. Tests
> {{TestCheckpoint}} asserts the reason the client reports for a refused
> transfer.
> Depends on HADOOP-20003.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]