HDFS-9091. Erasure Coding: Provide DistributedFilesystem API to getAllErasureCodingPolicies. Contributed by Rakesh R.
Change-Id: Id30a1ce9e2ce676d00a9220a2d3f14b8d9f00527
This commit is contained in:
parent
b762199adb
commit
a9e6681edf
@ -441,3 +441,6 @@
|
||||
|
||||
HDFS-9113. ErasureCodingWorker#processErasureCodingTasks should not fail to process
|
||||
remaining tasks due to one invalid ECTask (umamahesh)
|
||||
|
||||
HDFS-9091. Erasure Coding: Provide DistributedFilesystem API to
|
||||
getAllErasureCodingPolicies. (Rakesh R via zhz)
|
||||
|
@ -2324,4 +2324,15 @@ public ErasureCodingPolicy next(final FileSystem fs, final Path p)
|
||||
}
|
||||
}.resolve(this, absF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the erasure coding policies supported by this file system.
|
||||
*
|
||||
* @return all erasure coding policies supported by this file system.
|
||||
* @throws IOException
|
||||
*/
|
||||
public Collection<ErasureCodingPolicy> getAllErasureCodingPolicies()
|
||||
throws IOException {
|
||||
return Arrays.asList(dfs.getErasureCodingPolicies());
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
|
||||
import static org.junit.Assert.*;
|
||||
@ -231,4 +232,18 @@ public void testCreationErasureCodingZoneWithInvalidPolicy()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllErasureCodingPolicies() throws Exception {
|
||||
ErasureCodingPolicy[] sysECPolicies = ErasureCodingPolicyManager
|
||||
.getSystemPolices();
|
||||
assertTrue("System ecPolicies should be of only 1 for now",
|
||||
sysECPolicies.length == 1);
|
||||
|
||||
Collection<ErasureCodingPolicy> allECPolicies = fs
|
||||
.getAllErasureCodingPolicies();
|
||||
assertTrue("All ecPolicies should be of only 1 for now",
|
||||
allECPolicies.size() == 1);
|
||||
assertEquals("Erasure coding policy mismatches",
|
||||
sysECPolicies[0], allECPolicies.iterator().next());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user