HDFS-8879. Quota by storage type usage incorrectly initialized upon namenode restart. Contributed by Xiaoyu Yao.
(cherry picked from commit 3e715a4f4c
)
This commit is contained in:
parent
43f386e748
commit
458b684941
|
@ -786,6 +786,9 @@ Release 2.8.0 - UNRELEASED
|
|||
|
||||
HDFS-8866. Typo in docs: Rumtime -> Runtime. (Gabor Liptak via jghoman)
|
||||
|
||||
HDFS-8879. Quota by storage type usage incorrectly initialized upon namenode
|
||||
restart. (xyao)
|
||||
|
||||
Release 2.7.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -911,11 +911,9 @@ public class FSImage implements Closeable {
|
|||
+ " quota = " + ssQuota + " < consumed = " + ssConsumed);
|
||||
}
|
||||
|
||||
final EnumCounters<StorageType> typeSpaces =
|
||||
new EnumCounters<StorageType>(StorageType.class);
|
||||
final EnumCounters<StorageType> typeSpaces = counts.getTypeSpaces();
|
||||
for (StorageType t : StorageType.getTypesSupportingQuota()) {
|
||||
final long typeSpace = counts.getTypeSpaces().get(t) -
|
||||
parentTypeSpaces.get(t);
|
||||
final long typeSpace = typeSpaces.get(t) - parentTypeSpaces.get(t);
|
||||
final long typeQuota = q.getTypeSpaces().get(t);
|
||||
if (Quota.isViolated(typeQuota, typeSpace)) {
|
||||
LOG.warn("Storage type quota violation in image for "
|
||||
|
|
|
@ -67,10 +67,7 @@ public class TestQuotaByStorageType {
|
|||
.storageTypes(new StorageType[]{StorageType.SSD, StorageType.DEFAULT})
|
||||
.build();
|
||||
cluster.waitActive();
|
||||
|
||||
fsdir = cluster.getNamesystem().getFSDirectory();
|
||||
dfs = cluster.getFileSystem();
|
||||
fsn = cluster.getNamesystem();
|
||||
refreshClusterState();
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -80,6 +77,13 @@ public class TestQuotaByStorageType {
|
|||
}
|
||||
}
|
||||
|
||||
// Cluster state must be refreshed after each start/restart in the test
|
||||
private void refreshClusterState() throws IOException{
|
||||
fsdir = cluster.getNamesystem().getFSDirectory();
|
||||
dfs = cluster.getFileSystem();
|
||||
fsn = cluster.getNamesystem();
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
public void testQuotaByStorageTypeWithFileCreateOneSSD() throws Exception {
|
||||
testQuotaByStorageTypeWithFileCreateCase(
|
||||
|
@ -662,6 +666,7 @@ public class TestQuotaByStorageType {
|
|||
|
||||
// Restart namenode to make sure the editlog is correct
|
||||
cluster.restartNameNode(true);
|
||||
refreshClusterState();
|
||||
|
||||
INode testDirNodeAfterNNRestart = fsdir.getINode4Write(testDir.toString());
|
||||
// Verify quota is still set
|
||||
|
@ -714,6 +719,7 @@ public class TestQuotaByStorageType {
|
|||
dfs.saveNamespace();
|
||||
dfs.setSafeMode(HdfsConstants.SafeModeAction.SAFEMODE_LEAVE);
|
||||
cluster.restartNameNode(true);
|
||||
refreshClusterState();
|
||||
|
||||
INode testDirNodeAfterNNRestart = fsdir.getINode4Write(testDir.toString());
|
||||
assertTrue(testDirNode.isDirectory());
|
||||
|
|
Loading…
Reference in New Issue