|
@@ -86,6 +86,9 @@ public class TestQuota {
|
|
// Space quotas
|
|
// Space quotas
|
|
final int DEFAULT_BLOCK_SIZE = 512;
|
|
final int DEFAULT_BLOCK_SIZE = 512;
|
|
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, DEFAULT_BLOCK_SIZE);
|
|
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, DEFAULT_BLOCK_SIZE);
|
|
|
|
+ // Make it relinquish locks. When run serially, the result should
|
|
|
|
+ // be identical.
|
|
|
|
+ conf.setInt(DFSConfigKeys.DFS_CONTENT_SUMMARY_LIMIT_KEY, 2);
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
@@ -350,6 +353,7 @@ public class TestQuota {
|
|
}
|
|
}
|
|
assertTrue(hasException);
|
|
assertTrue(hasException);
|
|
|
|
|
|
|
|
+ assertEquals(4, cluster.getNamesystem().getFSDirectory().getYieldCount());
|
|
} finally {
|
|
} finally {
|
|
cluster.shutdown();
|
|
cluster.shutdown();
|
|
}
|
|
}
|
|
@@ -360,6 +364,9 @@ public class TestQuota {
|
|
@Test
|
|
@Test
|
|
public void testNamespaceCommands() throws Exception {
|
|
public void testNamespaceCommands() throws Exception {
|
|
final Configuration conf = new HdfsConfiguration();
|
|
final Configuration conf = new HdfsConfiguration();
|
|
|
|
+ // Make it relinquish locks. When run serially, the result should
|
|
|
|
+ // be identical.
|
|
|
|
+ conf.setInt(DFSConfigKeys.DFS_CONTENT_SUMMARY_LIMIT_KEY, 2);
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
@@ -515,6 +522,7 @@ public class TestQuota {
|
|
c = dfs.getContentSummary(quotaDir1);
|
|
c = dfs.getContentSummary(quotaDir1);
|
|
assertEquals(c.getDirectoryCount(), 6);
|
|
assertEquals(c.getDirectoryCount(), 6);
|
|
assertEquals(c.getQuota(), 6);
|
|
assertEquals(c.getQuota(), 6);
|
|
|
|
+ assertEquals(14, cluster.getNamesystem().getFSDirectory().getYieldCount());
|
|
} finally {
|
|
} finally {
|
|
cluster.shutdown();
|
|
cluster.shutdown();
|
|
}
|
|
}
|
|
@@ -532,6 +540,9 @@ public class TestQuota {
|
|
// set a smaller block size so that we can test with smaller
|
|
// set a smaller block size so that we can test with smaller
|
|
// diskspace quotas
|
|
// diskspace quotas
|
|
conf.set(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, "512");
|
|
conf.set(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, "512");
|
|
|
|
+ // Make it relinquish locks. When run serially, the result should
|
|
|
|
+ // be identical.
|
|
|
|
+ conf.setInt(DFSConfigKeys.DFS_CONTENT_SUMMARY_LIMIT_KEY, 2);
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
final FileSystem fs = cluster.getFileSystem();
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
assertTrue("Not a HDFS: "+fs.getUri(),
|
|
@@ -764,6 +775,7 @@ public class TestQuota {
|
|
assertEquals(c.getSpaceConsumed(),
|
|
assertEquals(c.getSpaceConsumed(),
|
|
(sizeFactorA + sizeFactorB + sizeFactorC) * fileSpace);
|
|
(sizeFactorA + sizeFactorB + sizeFactorC) * fileSpace);
|
|
|
|
|
|
|
|
+ assertEquals(20, cluster.getNamesystem().getFSDirectory().getYieldCount());
|
|
} finally {
|
|
} finally {
|
|
cluster.shutdown();
|
|
cluster.shutdown();
|
|
}
|
|
}
|
|
@@ -905,6 +917,9 @@ public class TestQuota {
|
|
final int BLOCK_SIZE = 6 * 1024;
|
|
final int BLOCK_SIZE = 6 * 1024;
|
|
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE);
|
|
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE);
|
|
conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
|
|
conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
|
|
|
|
+ // Make it relinquish locks. When run serially, the result should
|
|
|
|
+ // be identical.
|
|
|
|
+ conf.setInt(DFSConfigKeys.DFS_CONTENT_SUMMARY_LIMIT_KEY, 2);
|
|
MiniDFSCluster cluster =
|
|
MiniDFSCluster cluster =
|
|
new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
|
|
new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
@@ -971,6 +986,7 @@ public class TestQuota {
|
|
exceededQuota = true;
|
|
exceededQuota = true;
|
|
}
|
|
}
|
|
assertTrue("Quota not exceeded", exceededQuota);
|
|
assertTrue("Quota not exceeded", exceededQuota);
|
|
|
|
+ assertEquals(2, cluster.getNamesystem().getFSDirectory().getYieldCount());
|
|
} finally {
|
|
} finally {
|
|
cluster.shutdown();
|
|
cluster.shutdown();
|
|
}
|
|
}
|