HDFS-15576. Erasure Coding: Add rs and rs-legacy codec test for addPolicies. Contributed by Fei Hui.

This commit is contained in:
Takanobu Asanuma 2020-09-16 01:36:46 +09:00
parent f4ed9f3f91
commit 5c5b2ed7c7
3 changed files with 33 additions and 4 deletions

View File

@ -52,12 +52,12 @@ public void testLoadECPolicy() throws Exception {
out.println("<layoutversion>1</layoutversion>"); out.println("<layoutversion>1</layoutversion>");
out.println("<schemas>"); out.println("<schemas>");
out.println(" <schema id=\"RSk12m4\">"); out.println(" <schema id=\"RSk12m4\">");
out.println(" <codec>RS</codec>"); out.println(" <codec>rs</codec>");
out.println(" <k>12</k>"); out.println(" <k>12</k>");
out.println(" <m>4</m>"); out.println(" <m>4</m>");
out.println(" </schema>"); out.println(" </schema>");
out.println(" <schema id=\"RS-legacyk12m4\">"); out.println(" <schema id=\"RS-legacyk12m4\">");
out.println(" <codec>RS-legacy</codec>"); out.println(" <codec>rs-legacy</codec>");
out.println(" <k>12</k>"); out.println(" <k>12</k>");
out.println(" <m>4</m>"); out.println(" <m>4</m>");
out.println(" </schema>"); out.println(" </schema>");
@ -87,7 +87,7 @@ public void testLoadECPolicy() throws Exception {
assertEquals(0, schema1.getExtraOptions().size()); assertEquals(0, schema1.getExtraOptions().size());
assertEquals(12, schema1.getNumDataUnits()); assertEquals(12, schema1.getNumDataUnits());
assertEquals(4, schema1.getNumParityUnits()); assertEquals(4, schema1.getNumParityUnits());
assertEquals("RS", schema1.getCodecName()); assertEquals("rs", schema1.getCodecName());
ErasureCodingPolicy policy2 = policies.get(1); ErasureCodingPolicy policy2 = policies.get(1);
ECSchema schema2 = policy2.getSchema(); ECSchema schema2 = policy2.getSchema();
@ -95,7 +95,7 @@ public void testLoadECPolicy() throws Exception {
assertEquals(0, schema2.getExtraOptions().size()); assertEquals(0, schema2.getExtraOptions().size());
assertEquals(12, schema2.getNumDataUnits()); assertEquals(12, schema2.getNumDataUnits());
assertEquals(4, schema2.getNumParityUnits()); assertEquals(4, schema2.getNumParityUnits());
assertEquals("RS-legacy", schema2.getCodecName()); assertEquals("rs-legacy", schema2.getCodecName());
} }
/** /**

View File

@ -484,6 +484,14 @@
<type>SubstringComparator</type> <type>SubstringComparator</type>
<expected-output>Add ErasureCodingPolicy XOR-2-1-128k succeed</expected-output> <expected-output>Add ErasureCodingPolicy XOR-2-1-128k succeed</expected-output>
</comparator> </comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>Add ErasureCodingPolicy RS-12-4-128k succeed</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>Add ErasureCodingPolicy RS-LEGACY-12-4-128k succeed</expected-output>
</comparator>
<comparator> <comparator>
<type>SubstringComparator</type> <type>SubstringComparator</type>
<expected-output>Add ErasureCodingPolicy RS-6-3-1024k failed</expected-output> <expected-output>Add ErasureCodingPolicy RS-6-3-1024k failed</expected-output>

View File

@ -41,7 +41,20 @@
<m>1</m> <m>1</m>
<options> </options> <options> </options>
</schema> </schema>
<schema id="RSk12m4">
<codec>rs</codec>
<k>12</k>
<m>4</m>
<options> </options>
</schema>
<schema id="RS-LEGACYk12m4">
<codec>rs-legacy</codec>
<k>12</k>
<m>4</m>
<options> </options>
</schema>
<schema id="RSk6m3"> <schema id="RSk6m3">
<!-- just for failed test -->
<codec>RS</codec> <codec>RS</codec>
<k>6</k> <k>6</k>
<m>3</m> <m>3</m>
@ -57,6 +70,14 @@
<!-- cellsize must be an positive integer multiple of 1024(1k) --> <!-- cellsize must be an positive integer multiple of 1024(1k) -->
<cellsize>131072</cellsize> <cellsize>131072</cellsize>
</policy> </policy>
<policy>
<schema>RSk12m4</schema>
<cellsize>131072</cellsize>
</policy>
<policy>
<schema>RS-LEGACYk12m4</schema>
<cellsize>131072</cellsize>
</policy>
<policy> <policy>
<schema>RSk6m3</schema> <schema>RSk6m3</schema>
<cellsize>1048576</cellsize> <cellsize>1048576</cellsize>