[
https://issues.apache.org/jira/browse/HDFS-11273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15799513#comment-15799513
]
Jing Zhao commented on HDFS-11273:
----------------------------------
Thanks for updating the patch, [~hkoneru]! The updated patch is almost there. I
have several extra minor comments (sorry I did not mention them in my last
review...):
# The new Util#setTimeout method may no longer only load timeout value from
"DFS_IMAGE_TRANSFER_TIMEOUT_KEY". Thus the code loading timeout from
configuration can be left in TransferFsImage#doGetUrl.
{code}
+ /**
+ * Sets a timeout value in millisecods for the Http connection.
+ * @param connection the Http connection for which timeout needs to be set
+ * @param timeout value to be set as timeout in milliseconds
+ */
+ public static void setTimeout(HttpURLConnection connection, int timeout) {
+ if (timeout <= 0) {
+ Configuration conf = new HdfsConfiguration();
+ timeout = conf.getInt(
+ DFSConfigKeys.DFS_IMAGE_TRANSFER_TIMEOUT_KEY,
+ DFSConfigKeys.DFS_IMAGE_TRANSFER_TIMEOUT_DEFAULT);
+ LOG.info("Image Transfer timeout configured to " + timeout
+ + " milliseconds");
+ }
+
+ if (timeout > 0) {
+ connection.setConnectTimeout(timeout);
+ connection.setReadTimeout(timeout);
+ }
+ }
{code}
# HttpGetFailedException can be defined as an upper level class and be moved to
the o.a.h.hdfs.server.common package.
# The following code can be reformatted.
{code}
+ public static MD5Hash doGetUrl(URL url, List<File> localPaths,
+ Storage dstStorage, boolean getChecksum, URLConnectionFactory
+ connectionFactory, int ioFileBufferSize, boolean isSpnegoEnabled, int
+ timeout) throws IOException {
{code}
> Move TransferFsImage#doGetUrl function to a Util class
> ------------------------------------------------------
>
> Key: HDFS-11273
> URL: https://issues.apache.org/jira/browse/HDFS-11273
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: Hanisha Koneru
> Assignee: Hanisha Koneru
> Attachments: HDFS-11273.000.patch, HDFS-11273.001.patch
>
>
> TransferFsImage#doGetUrl downloads files from the specified url and stores
> them in the specified storage location. HDFS-4025 plans to synchronize the
> log segments in JournalNodes. If a log segment is missing from a JN, the JN
> downloads it from another JN which has the required log segment. We need
> TransferFsImage#doGetUrl and TransferFsImage#receiveFile to accomplish this.
> So we propose to move the said functions to a Utility class so as to be able
> to use it for JournalNode syncing as well, without duplication of code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]