hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xudong Cao (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (HDFS-14646) Standby NameNode should not upload fsimage to an inappropriate NameNode.
Date Mon, 26 Aug 2019 02:08:00 GMT

    [ https://issues.apache.org/jira/browse/HDFS-14646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915412#comment-16915412
] 

Xudong Cao edited comment on HDFS-14646 at 8/26/19 2:07 AM:
------------------------------------------------------------

Thanks [~csun] , our production environment uses Hadoop version 2.7.2, but merged multi-SBN
feature. We have about 20,000 machines (divided into dozens of HDFS clusters).  Not long
ago, we frequently encountered the problem described by the jira.  and after this patch was
merged, the errors are no longer reported.


was (Author: xudongcao):
Thanks [~csun] , our production environment uses Hadoop version 2.7.2, but merged multi-SBN
feature. We have about 20,000 machines (divided into dozens of clusters).  Not long ago,
we frequently encountered the problem described by the jira.  and after this patch was merged,
the errors are no longer reported.

> Standby NameNode should not upload fsimage to an inappropriate NameNode.
> ------------------------------------------------------------------------
>
>                 Key: HDFS-14646
>                 URL: https://issues.apache.org/jira/browse/HDFS-14646
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs
>    Affects Versions: 3.1.2
>            Reporter: Xudong Cao
>            Assignee: Xudong Cao
>            Priority: Major
>         Attachments: HDFS-14646.000.patch, HDFS-14646.001.patch, HDFS-14646.002.patch,
HDFS-14646.003.patch
>
>
> *Problem Description:*
>  In the multi-NameNode scenario, when a SNN uploads a FsImage, it will put the image
to all other NNs (whether the peer NN is an ANN or not), and even if the peer NN immediately
replies an error (such as TransferResult.NOT_ACTIVE_NAMENODE_FAILURE, TransferResult .OLD_TRANSACTION_ID_FAILURE,
etc.), the local SNN will not terminate the put process immediately, but will put the FsImage
completely to the peer NN, and will not read the peer NN's reply until the put is completed.
> Depending on the version of Jetty, this behavior can lead to different consequences, I
tested it under 2.7.2 and trunk version. 
> *1.In Hadoop 2.7.2 (with Jetty 6.1.26)*
>  After peer NN called HttpServletResponse.sendError(), the underlying TCP connection
will still be established, and the data SNN sent will be read by Jetty framework itself in
the peer NN side, so the SNN will insignificantly send the FsImage to the peer NN continuously,
causing a waste of time and bandwidth. In a relatively large HDFS cluster, the size of FsImage
can often reach about 30GB, This is indeed a big waste.
> *2.In trunk version (with Jetty 9.3.27)*
>  After peer NN called HttpServletResponse.sendError(), the underlying TCP connection
will be auto closed, and then SNN will directly get an "Error writing request body to server"
exception, as below, note this test needs a relatively big FSImage (e.g. 10MB level):
> {code:java}
> 2019-08-17 03:59:25,413 INFO namenode.TransferFsImage: Sending fileName: /tmp/hadoop-root/dfs/name/current/fsimage_0000000000003364240,
fileSize: 9864721. Sent total: 524288 bytes. Size of last segment intended to send: 4096 bytes.
>  java.io.IOException: Error writing request body to server
>  at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3587)
>  at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3570)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.copyFileToStream(TransferFsImage.java:396)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.writeFileToPutRequest(TransferFsImage.java:340)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.uploadImage(TransferFsImage.java:314)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.uploadImageFromStorage(TransferFsImage.java:249)
>  at org.apache.hadoop.hdfs.server.namenode.ha.StandbyCheckpointer$1.call(StandbyCheckpointer.java:277)
>  at org.apache.hadoop.hdfs.server.namenode.ha.StandbyCheckpointer$1.call(StandbyCheckpointer.java:272)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
>  2019-08-17 03:59:25,422 INFO namenode.TransferFsImage: Sending fileName: /tmp/hadoop-root/dfs/name/current/fsimage_0000000000003364240,
fileSize: 9864721. Sent total: 851968 bytes. Size of last segment intended to send: 4096 bytes.
>  java.io.IOException: Error writing request body to server
>  at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3587)
>  at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3570)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.copyFileToStream(TransferFsImage.java:396)
>  at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.writeFileToPutRequest(TransferFsImage.java:340) 
{code}
>                   
> *Solution:*
>  A standby NameNode should not upload fsimage to an inappropriate NameNode, when he plans
to put a FsImage to the peer NN, he need to check whether he really need to put it at this
time.
> In detail, local SNN should establish an HTTP connection with the peer NN, send the put
request, and then immediately read the response (this is the key point). If the peer NN does
not reply an HTTP_OK, it means the local SNN should not put image at this time.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message