|
@@ -20,6 +20,7 @@ package org.apache.hadoop.hdfs.server.namenode.ha;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
|
|
+import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.InvocationHandler;
|
|
import java.lang.reflect.InvocationHandler;
|
|
import java.lang.reflect.Method;
|
|
import java.lang.reflect.Method;
|
|
@@ -646,10 +647,14 @@ public class TestRetryCacheWithHA {
|
|
@Override
|
|
@Override
|
|
boolean checkNamenodeBeforeReturn() throws Exception {
|
|
boolean checkNamenodeBeforeReturn() throws Exception {
|
|
Path linkPath = new Path(link);
|
|
Path linkPath = new Path(link);
|
|
- FileStatus linkStatus = dfs.getFileLinkStatus(linkPath);
|
|
|
|
|
|
+ FileStatus linkStatus = null;
|
|
for (int i = 0; i < CHECKTIMES && linkStatus == null; i++) {
|
|
for (int i = 0; i < CHECKTIMES && linkStatus == null; i++) {
|
|
- Thread.sleep(1000);
|
|
|
|
- linkStatus = dfs.getFileLinkStatus(linkPath);
|
|
|
|
|
|
+ try {
|
|
|
|
+ linkStatus = dfs.getFileLinkStatus(linkPath);
|
|
|
|
+ } catch (FileNotFoundException fnf) {
|
|
|
|
+ // Ignoring, this can be legitimate.
|
|
|
|
+ Thread.sleep(1000);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return linkStatus != null;
|
|
return linkStatus != null;
|
|
}
|
|
}
|
|
@@ -857,4 +862,4 @@ public class TestRetryCacheWithHA {
|
|
+ results.get(op.name));
|
|
+ results.get(op.name));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|