diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java index 4c8d745..1e3da4b 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java @@ -420,7 +420,7 @@ public void applicationStarted(ApplicationStartData appStart) + appStart.getApplicationId()); } catch (IOException e) { LOG.error("Error when openning history file of application " - + appStart.getApplicationId()); + + appStart.getApplicationId(), e); throw e; } outstandingWriters.put(appStart.getApplicationId(), hfWriter); @@ -437,7 +437,7 @@ public void applicationStarted(ApplicationStartData appStart) + appStart.getApplicationId() + " is written"); } catch (IOException e) { LOG.error("Error when writing start information of application " - + appStart.getApplicationId()); + + appStart.getApplicationId(), e); throw e; } } @@ -676,9 +676,10 @@ public Entry(HistoryDataKey key, byte[] value) { private TFile.Reader reader; private TFile.Reader.Scanner scanner; + FSDataInputStream fsdis; public HistoryFileReader(Path historyFile) throws IOException { - FSDataInputStream fsdis = fs.open(historyFile); + fsdis = fs.open(historyFile); reader = new TFile.Reader(fsdis, fs.getFileStatus(historyFile).getLen(), getConfig()); @@ -707,7 +708,7 @@ public void reset() throws IOException { } public void close() { - IOUtils.cleanup(LOG, scanner, reader); + IOUtils.cleanup(LOG, scanner, reader, fsdis); } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java index bc16d36..249fd90 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java @@ -23,6 +23,8 @@ import junit.framework.Assert; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -42,6 +44,9 @@ public class TestFileSystemApplicationHistoryStore extends ApplicationHistoryStoreTestUtils { + private static Log LOG = LogFactory + .getLog(TestFileSystemApplicationHistoryStore.class.getName()); + private FileSystem fs; private Path fsWorkingPath; @@ -50,9 +55,12 @@ public void setup() throws Exception { fs = new RawLocalFileSystem(); Configuration conf = new Configuration(); fs.initialize(new URI("/"), conf); - fsWorkingPath = new Path("Test"); + fsWorkingPath = + new Path("target", + TestFileSystemApplicationHistoryStore.class.getSimpleName()); fs.delete(fsWorkingPath, true); - conf.set(YarnConfiguration.FS_APPLICATION_HISTORY_STORE_URI, fsWorkingPath.toString()); + conf.set(YarnConfiguration.FS_APPLICATION_HISTORY_STORE_URI, + fsWorkingPath.toString()); store = new FileSystemApplicationHistoryStore(); store.init(conf); store.start(); @@ -67,6 +75,7 @@ public void tearDown() throws Exception { @Test public void testReadWriteHistoryData() throws IOException { + LOG.info("Starting testReadWriteHistoryData"); testWriteHistoryData(5); testReadHistoryData(5); } @@ -167,6 +176,7 @@ private void testReadHistoryData( @Test public void testWriteAfterApplicationFinish() throws IOException { + LOG.info("Starting testWriteAfterApplicationFinish"); ApplicationId appId = ApplicationId.newInstance(0, 1); writeApplicationStartData(appId); writeApplicationFinishData(appId); @@ -203,6 +213,7 @@ public void testWriteAfterApplicationFinish() throws IOException { @Test public void testMassiveWriteContainerHistoryData() throws IOException { + LOG.info("Starting testMassiveWriteContainerHistoryData"); long mb = 1024 * 1024; long usedDiskBefore = fs.getContentSummary(fsWorkingPath).getLength() / mb; ApplicationId appId = ApplicationId.newInstance(0, 1); @@ -221,12 +232,14 @@ public void testMassiveWriteContainerHistoryData() throws IOException { @Test public void testMissingContainerHistoryData() throws IOException { + LOG.info("Starting testMissingContainerHistoryData"); testWriteHistoryData(3, true, false); testReadHistoryData(3, true, false); } @Test public void testMissingApplicationAttemptHistoryData() throws IOException { + LOG.info("Starting testMissingApplicationAttemptHistoryData"); testWriteHistoryData(3, false, true); testReadHistoryData(3, false, true); }