|
@@ -36,6 +36,7 @@ import java.util.Map.Entry;
|
|
|
import java.util.Random;
|
|
|
import java.util.Set;
|
|
|
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.fgl.FSNamesystemLockMode;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -119,6 +120,7 @@ public class TestDatanodeManager {
|
|
|
//Create the DatanodeManager which will be tested
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
Configuration conf = new Configuration();
|
|
|
conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 0);
|
|
|
conf.setLong(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 10);
|
|
@@ -154,6 +156,7 @@ public class TestDatanodeManager {
|
|
|
//Create the DatanodeManager which will be tested
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
Configuration conf = new Configuration();
|
|
|
DatanodeManager dm = mockDatanodeManager(fsn, conf);
|
|
|
|
|
@@ -184,6 +187,7 @@ public class TestDatanodeManager {
|
|
|
//Create the DatanodeManager which will be tested
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
DatanodeManager dm = mockDatanodeManager(fsn, new Configuration());
|
|
|
|
|
|
//Seed the RNG with a known value so test failures are easier to reproduce
|
|
@@ -283,7 +287,8 @@ public class TestDatanodeManager {
|
|
|
//Create the DatanodeManager which will be tested
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
-
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
+
|
|
|
Configuration conf = new Configuration();
|
|
|
|
|
|
//Set configuration property for rejecting unresolved topology mapping
|
|
@@ -401,6 +406,7 @@ public class TestDatanodeManager {
|
|
|
Configuration conf = new Configuration();
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
if (scriptFileName != null && !scriptFileName.isEmpty()) {
|
|
|
URL shellScript = getClass().getResource(scriptFileName);
|
|
|
Path resourcePath = Paths.get(shellScript.toURI());
|
|
@@ -499,6 +505,7 @@ public class TestDatanodeManager {
|
|
|
Configuration conf = new Configuration();
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
URL shellScript = getClass().getResource(
|
|
|
"/" + Shell.appendScriptExtension("topology-script"));
|
|
|
Path resourcePath = Paths.get(shellScript.toURI());
|
|
@@ -648,6 +655,7 @@ public class TestDatanodeManager {
|
|
|
DFSConfigKeys.DFS_NAMENODE_AVOID_STALE_DATANODE_FOR_READ_KEY, true);
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
URL shellScript = getClass()
|
|
|
.getResource("/" + Shell.appendScriptExtension("topology-script"));
|
|
|
Path resourcePath = Paths.get(shellScript.toURI());
|
|
@@ -715,6 +723,7 @@ public class TestDatanodeManager {
|
|
|
DFSConfigKeys.DFS_NAMENODE_AVOID_STALE_DATANODE_FOR_READ_KEY, true);
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
URL shellScript = getClass()
|
|
|
.getResource("/" + Shell.appendScriptExtension("topology-script"));
|
|
|
Path resourcePath = Paths.get(shellScript.toURI());
|
|
@@ -801,6 +810,7 @@ public class TestDatanodeManager {
|
|
|
DFSConfigKeys.DFS_NAMENODE_AVOID_STALE_DATANODE_FOR_READ_KEY, true);
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
URL shellScript = getClass()
|
|
|
.getResource("/" + Shell.appendScriptExtension("topology-script"));
|
|
|
Path resourcePath = Paths.get(shellScript.toURI());
|
|
@@ -890,6 +900,7 @@ public class TestDatanodeManager {
|
|
|
|
|
|
// Set the write lock so that the DatanodeManager can start
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
|
|
|
DatanodeManager dm = mockDatanodeManager(fsn, new Configuration());
|
|
|
HostFileManager hm = new HostFileManager();
|
|
@@ -988,6 +999,7 @@ public class TestDatanodeManager {
|
|
|
throws IOException {
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
Configuration conf = new Configuration();
|
|
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_MAX_STREAMS_KEY, maxTransfers);
|
|
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_STREAMS_HARD_LIMIT_KEY,
|
|
@@ -1142,6 +1154,7 @@ public class TestDatanodeManager {
|
|
|
throws IOException {
|
|
|
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
|
|
|
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
|
|
|
+ Mockito.when(fsn.hasWriteLock(FSNamesystemLockMode.BM)).thenReturn(true);
|
|
|
Configuration conf = new Configuration();
|
|
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_MAX_STREAMS_KEY, maxTransfers);
|
|
|
DatanodeManager dm = Mockito.spy(mockDatanodeManager(fsn, conf));
|