File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3 Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -170,15 +170,19 @@ private void prepareAddressMap() throws IOException {
170170 // if a unique nnid, add it to the map
171171 if (value == null ) {
172172 LOG .info ("Added export: {} FileSystem URI: {} with namenodeId: {}" ,
173- exportPath , exportPath , namenodeId );
173+ exportPath , exportURI , namenodeId );
174174 namenodeUriMap .put (namenodeId , exportURI );
175- } else {
176- // if the nnid already exists, it better be the for the same namenode
175+ } else if (! value . equals ( exportURI )) {
176+ // Only throw exception if different URIs have the same namenode ID
177177 String msg = String .format ("FS:%s, Namenode ID collision for path:%s "
178178 + "nnid:%s uri being added:%s existing uri:%s" , fs .getScheme (),
179179 exportPath , namenodeId , exportURI , value );
180180 LOG .error (msg );
181181 throw new FileSystemException (msg );
182+ } else {
183+ // Same URI with same namenode ID - this is expected and safe to ignore
184+ LOG .debug ("Export path {} resolves to same URI {} as existing entry, skipping" ,
185+ exportPath , exportURI );
182186 }
183187 }
184188 }
Original file line number Diff line number Diff line change 2121import java .net .InetSocketAddress ;
2222import java .net .URI ;
2323import java .nio .file .FileSystemException ;
24+ import java .util .Objects ;
2425
2526import io .netty .buffer .ByteBuf ;
2627import io .netty .channel .Channel ;
@@ -242,7 +243,7 @@ public static int getNamenodeId(Configuration conf) {
242243 public static int getNamenodeId (Configuration conf , URI namenodeURI ) {
243244 InetSocketAddress address =
244245 DFSUtilClient .getNNAddressCheckLogical (conf , namenodeURI );
245- return address .hashCode ( );
246+ return Objects . hash ( namenodeURI . toString (), address .toString () );
246247 }
247248
248249 public static URI getResolvedURI (FileSystem fs , String exportPath )
You can’t perform that action at this time.
0 commit comments