This is an automated email from the ASF dual-hosted git repository.

abmodi pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 44850f6  YARN-9816. EntityGroupFSTimelineStore#scanActiveLogs fails 
when undesired files are present under /ats/active. Contribued by Prabhu Joseph.
44850f6 is described below

commit 44850f67848bd6fe5bfc2ebad693da77184053b7
Author: Abhishek Modi <abm...@apache.org>
AuthorDate: Thu Sep 12 12:50:10 2019 +0530

    YARN-9816. EntityGroupFSTimelineStore#scanActiveLogs fails when undesired 
files are present under /ats/active. Contribued by Prabhu Joseph.
---
 .../server/timeline/EntityGroupFSTimelineStore.java     |  7 ++++++-
 .../server/timeline/TestEntityGroupFSTimelineStore.java | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java
index e10eb1b..8f00b85 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java
@@ -376,7 +376,12 @@ public class EntityGroupFSTimelineStore extends 
CompositeService
         AppLogs logs = getAndSetActiveLog(appId, stat.getPath());
         executor.execute(new ActiveLogParser(logs));
       } else {
-        logsToScanCount += scanActiveLogs(stat.getPath());
+        if (stat.isDirectory()) {
+          logsToScanCount += scanActiveLogs(stat.getPath());
+        } else {
+          LOG.warn("Ignoring unexpected file in active directory {}",
+              stat.getPath());
+        }
       }
     }
     return logsToScanCount;
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestEntityGroupFSTimelineStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestEntityGroupFSTimelineStore.java
index 8fcc696..984e157 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestEntityGroupFSTimelineStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestEntityGroupFSTimelineStore.java
@@ -511,6 +511,23 @@ public class TestEntityGroupFSTimelineStore extends 
TimelineStoreTestUtils {
   }
 
   @Test
+  public void testScanActiveLogsWithInvalidFile() throws Exception {
+    Path invalidFile = new Path(testActiveDirPath, "invalidfile");
+    try {
+      if (!fs.exists(invalidFile)) {
+        fs.createNewFile(invalidFile);
+      }
+      store.scanActiveLogs();
+    } catch (StackOverflowError error) {
+      Assert.fail("EntityLogScanner crashed with StackOverflowError");
+    } finally {
+      if (fs.exists(invalidFile)) {
+        fs.delete(invalidFile, false);
+      }
+    }
+  }
+
+  @Test
   public void testScanActiveLogsAndMoveToDonePluginRead() throws Exception {
     EntityGroupFSTimelineStore store = null;
     ApplicationId appId =


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to