|
@@ -40,6 +40,7 @@ import java.util.concurrent.TimeoutException;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_FSLOCK_FAIR_KEY;
|
|
|
import static org.apache.hadoop.test.MetricsAsserts.assertCounter;
|
|
|
import static org.apache.hadoop.test.MetricsAsserts.assertGauge;
|
|
|
|
|
@@ -53,11 +54,11 @@ public class TestFSNamesystemLock {
|
|
|
public void testFsLockFairness() throws IOException, InterruptedException{
|
|
|
Configuration conf = new Configuration();
|
|
|
|
|
|
- conf.setBoolean("dfs.namenode.fslock.fair", true);
|
|
|
+ conf.setBoolean(DFS_NAMENODE_FSLOCK_FAIR_KEY, true);
|
|
|
FSNamesystemLock fsnLock = new FSNamesystemLock(conf, null);
|
|
|
assertTrue(fsnLock.coarseLock.isFair());
|
|
|
|
|
|
- conf.setBoolean("dfs.namenode.fslock.fair", false);
|
|
|
+ conf.setBoolean(DFS_NAMENODE_FSLOCK_FAIR_KEY, false);
|
|
|
fsnLock = new FSNamesystemLock(conf, null);
|
|
|
assertFalse(fsnLock.coarseLock.isFair());
|
|
|
}
|
|
@@ -103,7 +104,7 @@ public class TestFSNamesystemLock {
|
|
|
final int threadCount = 3;
|
|
|
final CountDownLatch latch = new CountDownLatch(threadCount);
|
|
|
final Configuration conf = new Configuration();
|
|
|
- conf.setBoolean("dfs.namenode.fslock.fair", true);
|
|
|
+ conf.setBoolean(DFS_NAMENODE_FSLOCK_FAIR_KEY, true);
|
|
|
final FSNamesystemLock rwLock = new FSNamesystemLock(conf, null);
|
|
|
rwLock.writeLock();
|
|
|
ExecutorService helper = Executors.newFixedThreadPool(threadCount);
|