Skip to content

Commit

Permalink
Avoid infinite loop in hadoop-FifoScheduler-DEFAULT_QUEUE.json
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Jun 30, 2024
1 parent 3f0acdf commit df3e64c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
7 changes: 6 additions & 1 deletion src/main/java/org/codetracker/AttributeTrackerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,23 @@ public History<Attribute> track() throws Exception {

ArrayDeque<Attribute> attributes = new ArrayDeque<>();
attributes.addFirst(start);
Map<String, List<String>> map = new LinkedHashMap<>();
HashSet<String> analysedCommits = new HashSet<>();
List<String> commits = null;
String lastFileName = null;
while (!attributes.isEmpty()) {
Attribute currentAttribute = attributes.poll();
if (currentAttribute.isAdded()) {
if (currentAttribute.isAdded() || currentAttribute.getVersion().getId().equals("0")) {
commits = null;
continue;
}
if (commits == null || !currentAttribute.getFilePath().equals(lastFileName)) {
lastFileName = currentAttribute.getFilePath();
commits = getCommits(repository, currentAttribute.getVersion().getId(), lastFileName, git);
if (map.containsKey(currentAttribute.getVersion().getId()) && map.get(currentAttribute.getVersion().getId()).equals(commits)) {
break;
}
map.put(currentAttribute.getVersion().getId(), commits);
historyReport.gitLogCommandCallsPlusPlus();
analysedCommits.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public History<Attribute> track() throws Exception {

ArrayDeque<Attribute> attributes = new ArrayDeque<>();
attributes.addFirst(start);
Map<String, List<String>> map = new LinkedHashMap<>();
HashSet<String> analysedCommits = new HashSet<>();
List<String> commits = null;
String lastFileName = null;
Expand All @@ -77,6 +78,10 @@ public History<Attribute> track() throws Exception {
String jsonPath = System.getProperty("user.dir") + "/src/test/resources/attribute/" + repoName + "-" + className + "-" + changeHistory.getAttributeName() + ".json";
File jsonFile = new File(jsonPath);
commits = getCommits(currentAttribute.getVersion().getId(), jsonFile);
if (map.containsKey(currentAttribute.getVersion().getId()) && map.get(currentAttribute.getVersion().getId()).equals(commits)) {
break;
}
map.put(currentAttribute.getVersion().getId(), commits);
historyReport.gitLogCommandCallsPlusPlus();
analysedCommits.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,39 +138,6 @@
"elementFileAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSSchedulerApp.java",
"elementNameAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(80)",
"comment": "new attribute"
},
{
"parentCommitId": "30099efb3525265f8b9fccd2709d45327f5b6724",
"commitId": "7f2b1eadc1b0807ec1302a0c3488bf6e7a59bc76",
"commitTime": 1342489383,
"changeType": "container change",
"elementFileBefore": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java",
"elementNameBefore": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(81)",
"elementFileAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerApp.java",
"elementNameAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(89)",
"comment": "Move And Rename Class org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp moved and renamed to org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp"
},
{
"parentCommitId": "bb0005cfec5fd2861600ff5babd259b48ba18b63",
"commitId": "cd7157784e5e5ddc4e77144d042e54dd0d04bac1",
"commitTime": 1314231264,
"changeType": "container change",
"elementFileBefore": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java",
"elementNameBefore": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(50)",
"elementFileAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java",
"elementNameAfter": "hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(50)",
"comment": "Move Source Folder hadoop-mapreduce to hadoop-mapreduce-project"
},
{
"parentCommitId": "dd86860633d2ed64705b669a75bf318442ed6225",
"commitId": "dbecbe5dfe50f834fc3b8401709079e9470cc517",
"commitTime": 1313665630,
"changeType": "introduced",
"elementFileBefore": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java",
"elementNameBefore": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(50)",
"elementFileAfter": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java",
"elementNameAfter": "hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApp@(private)liveContainers:Map<ContainerId,RMContainer>(50)",
"comment": "added with new class"
}
]
}
2 changes: 1 addition & 1 deletion src/test/resources/attribute/test-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hadoop-SchedulerApplicationAttempt-MEM_AGGREGATE_ALLOCATION_CACHE_MSECS.json, 1,
hadoop-SchedulerApplicationAttempt-lastMemoryAggregateAllocationUpdateTime.json, 1, 0, 0
hadoop-SchedulerApplicationAttempt-lastResourceSecondsMap.json, 1, 0, 0
hadoop-SchedulerApplicationAttempt-lastScheduledContainer.json, 7, 0, 0
hadoop-SchedulerApplicationAttempt-liveContainers.json, 11, 0, 0
hadoop-SchedulerApplicationAttempt-liveContainers.json, 8, 0, 0
hadoop-SchedulerApplicationAttempt-schedulingOpportunities.json, 7, 0, 0
hibernate-search-ClassLoaderHelper-log.json, 1, 0, 0
hibernate-search-DefaultBatchBackend-progressMonitor.json, 2, 0, 0
Expand Down

0 comments on commit df3e64c

Please sign in to comment.