HDFS-12579. JournalNodeSyncer should use fromUrl field of EditLogManifestResponse to construct servlet Url. Contributed by Hanisha Koneru.
This commit is contained in:
parent
f66ad1fab9
commit
7da15eac7a
@ -309,14 +309,22 @@ private void getMissingLogSegments(List<RemoteEditLog> thisJournalEditLogs,
|
|||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
if (remoteJNproxy.httpServerUrl == null) {
|
if (remoteJNproxy.httpServerUrl == null) {
|
||||||
remoteJNproxy.httpServerUrl = getHttpServerURI("http",
|
if (response.hasFromURL()) {
|
||||||
remoteJNproxy.jnAddr.getHostName(), response.getHttpPort());
|
remoteJNproxy.httpServerUrl = getHttpServerURI(
|
||||||
|
response.getFromURL(), remoteJNproxy.jnAddr.getHostName());
|
||||||
|
} else {
|
||||||
|
LOG.error("EditLogManifest response does not have fromUrl " +
|
||||||
|
"field set. Aborting current sync attempt");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String urlPath = GetJournalEditServlet.buildPath(jid, missingLog
|
String urlPath = GetJournalEditServlet.buildPath(jid, missingLog
|
||||||
.getStartTxId(), nsInfo, false);
|
.getStartTxId(), nsInfo, false);
|
||||||
url = new URL(remoteJNproxy.httpServerUrl, urlPath);
|
url = new URL(remoteJNproxy.httpServerUrl, urlPath);
|
||||||
success = downloadMissingLogSegment(url, missingLog);
|
success = downloadMissingLogSegment(url, missingLog);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
LOG.error("EditLogManifest's fromUrl field syntax incorrect", e);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
LOG.error("MalformedURL when download missing log segment", e);
|
LOG.error("MalformedURL when download missing log segment", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -374,9 +382,10 @@ private List<RemoteEditLog> getMissingLogList(
|
|||||||
return missingEditLogs;
|
return missingEditLogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private URL getHttpServerURI(String scheme, String hostname, int port)
|
private URL getHttpServerURI(String fromUrl, String hostAddr)
|
||||||
throws MalformedURLException {
|
throws URISyntaxException, MalformedURLException {
|
||||||
return new URL(scheme, hostname, port, "");
|
URI uri = new URI(fromUrl);
|
||||||
|
return new URL(uri.getScheme(), hostAddr, uri.getPort(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user