Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,19 @@ private void prepareAddressMap() throws IOException {
// if a unique nnid, add it to the map
if (value == null) {
LOG.info("Added export: {} FileSystem URI: {} with namenodeId: {}",
exportPath, exportPath, namenodeId);
exportPath, exportURI, namenodeId);
namenodeUriMap.put(namenodeId, exportURI);
} else {
// if the nnid already exists, it better be the for the same namenode
} else if (!value.equals(exportURI)) {
// Only throw exception if different URIs have the same namenode ID
String msg = String.format("FS:%s, Namenode ID collision for path:%s "
+ "nnid:%s uri being added:%s existing uri:%s", fs.getScheme(),
exportPath, namenodeId, exportURI, value);
LOG.error(msg);
throw new FileSystemException(msg);
} else {
// Same URI with same namenode ID - this is expected and safe to ignore
LOG.debug("Export path {} resolves to same URI {} as existing entry, skipping",
exportPath, exportURI);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.file.FileSystemException;
import java.util.Objects;

import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
Expand Down Expand Up @@ -242,7 +243,7 @@ public static int getNamenodeId(Configuration conf) {
public static int getNamenodeId(Configuration conf, URI namenodeURI) {
InetSocketAddress address =
DFSUtilClient.getNNAddressCheckLogical(conf, namenodeURI);
return address.hashCode();
return Objects.hash(namenodeURI.toString(), address.toString());
}

public static URI getResolvedURI(FileSystem fs, String exportPath)
Expand Down