HDFS-9155. OEV should treat .XML files as XML even when the file name extension is uppercase (nijel via cmccabe)

This commit is contained in:
Colin Patrick Mccabe 2015-10-05 12:53:58 -07:00
parent 3e1752f9fb
commit 2fc2b50534
3 changed files with 12 additions and 1 deletions

View File

@ -1013,6 +1013,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8979. Clean up checkstyle warnings in hadoop-hdfs-client module. HDFS-8979. Clean up checkstyle warnings in hadoop-hdfs-client module.
(Mingliang Liu via wheat9) (Mingliang Liu via wheat9)
HDFS-9155. OEV should treat .XML files as XML even when the file name
extension is uppercase (nijel via cmccabe)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -136,7 +136,7 @@ public int go(String inputFileName, String outputFileName, String processor,
visitor = OfflineEditsVisitorFactory.getEditsVisitor( visitor = OfflineEditsVisitorFactory.getEditsVisitor(
outputFileName, processor, flags.getPrintToScreen()); outputFileName, processor, flags.getPrintToScreen());
} }
boolean xmlInput = inputFileName.endsWith(".xml"); boolean xmlInput = inputFileName.toLowerCase().endsWith(".xml");
OfflineEditsLoader loader = OfflineEditsLoaderFactory. OfflineEditsLoader loader = OfflineEditsLoaderFactory.
createLoader(visitor, inputFileName, xmlInput, flags); createLoader(visitor, inputFileName, xmlInput, flags);
loader.loadEdits(); loader.loadEdits();

View File

@ -100,10 +100,17 @@ public void testGenerated() throws IOException {
LOG.info("Generated edits=" + edits); LOG.info("Generated edits=" + edits);
String editsParsedXml = folder.newFile("editsParsed.xml").getAbsolutePath(); String editsParsedXml = folder.newFile("editsParsed.xml").getAbsolutePath();
String editsReparsed = folder.newFile("editsParsed").getAbsolutePath(); String editsReparsed = folder.newFile("editsParsed").getAbsolutePath();
// capital case extension
String editsParsedXML_caseInSensitive =
folder.newFile("editsRecoveredParsed.XML").getAbsolutePath();
// parse to XML then back to binary // parse to XML then back to binary
assertEquals(0, runOev(edits, editsParsedXml, "xml", false)); assertEquals(0, runOev(edits, editsParsedXml, "xml", false));
assertEquals(0, runOev(edits, editsParsedXML_caseInSensitive, "xml", false));
assertEquals(0, runOev(editsParsedXml, editsReparsed, "binary", false)); assertEquals(0, runOev(editsParsedXml, editsReparsed, "binary", false));
assertEquals(0,
runOev(editsParsedXML_caseInSensitive, editsReparsed, "binary", false));
// judgment time // judgment time
assertTrue("Edits " + edits + " should have all op codes", assertTrue("Edits " + edits + " should have all op codes",
@ -115,6 +122,7 @@ public void testGenerated() throws IOException {
filesEqualIgnoreTrailingZeros(edits, editsReparsed)); filesEqualIgnoreTrailingZeros(edits, editsReparsed));
} }
@Test @Test
public void testRecoveryMode() throws IOException { public void testRecoveryMode() throws IOException {
// edits generated by nnHelper (MiniDFSCluster), should have all op codes // edits generated by nnHelper (MiniDFSCluster), should have all op codes