diff --git a/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml b/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml index f864c03145b..356189b2ba3 100644 --- a/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml +++ b/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml @@ -15,6 +15,14 @@ limitations under the License. --> + + + + + + + + diff --git a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml index dd421298300..eaab7e3c47c 100644 --- a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml +++ b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml @@ -660,4 +660,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/entity/TimelineEntityDocument.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/entity/TimelineEntityDocument.java index ea72ee36535..a0b42ebf1f5 100755 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/entity/TimelineEntityDocument.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/entity/TimelineEntityDocument.java @@ -138,14 +138,18 @@ public class TimelineEntityDocument implements } public void setMetrics(Map> metrics) { - for (String metricId : metrics.keySet()) { - for(TimelineMetricSubDoc metricSubDoc : metrics.get(metricId)) { + for (Map.Entry> metricEntry : + metrics.entrySet()) { + final String metricId = metricEntry.getKey(); + final Set metricValue = metricEntry.getValue(); + + for(TimelineMetricSubDoc metricSubDoc : metricValue) { timelineEntity.addMetric(metricSubDoc.fetchTimelineMetric()); } if (this.metrics.containsKey(metricId)) { - this.metrics.get(metricId).addAll(metrics.get(metricId)); + this.metrics.get(metricId).addAll(metricValue); } else { - this.metrics.put(metricId, new HashSet<>(metrics.get(metricId))); + this.metrics.put(metricId, new HashSet<>(metricValue)); } } } @@ -155,14 +159,18 @@ public class TimelineEntityDocument implements } public void setEvents(Map> events) { - for (String eventId : events.keySet()) { - for(TimelineEventSubDoc eventSubDoc: events.get(eventId)) { + for (Map.Entry> eventEntry : + events.entrySet()) { + final String eventId = eventEntry.getKey(); + final Set eventValue = eventEntry.getValue(); + + for(TimelineEventSubDoc eventSubDoc : eventValue) { timelineEntity.addEvent(eventSubDoc.fetchTimelineEvent()); } if (this.events.containsKey(eventId)) { this.events.get(eventId).addAll(events.get(eventId)); } else { - this.events.put(eventId, new HashSet<>(events.get(eventId))); + this.events.put(eventId, new HashSet<>(eventValue)); } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/flowrun/FlowRunDocument.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/flowrun/FlowRunDocument.java index 8ee87ab3c9f..d131cf24de1 100755 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/flowrun/FlowRunDocument.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/collection/document/flowrun/FlowRunDocument.java @@ -97,10 +97,14 @@ public class FlowRunDocument implements TimelineDocument { private void aggregateMetrics( Map metricSubDocMap) { - for(String metricId : metricSubDocMap.keySet()) { + for(Map.Entry metricEntry : + metricSubDocMap.entrySet()) { + final String metricId = metricEntry.getKey(); + final TimelineMetricSubDoc metricValue = metricEntry.getValue(); + if (this.metrics.containsKey(metricId)) { TimelineMetric incomingMetric = - metricSubDocMap.get(metricId).fetchTimelineMetric(); + metricValue.fetchTimelineMetric(); TimelineMetric baseMetric = this.metrics.get(metricId).fetchTimelineMetric(); if (incomingMetric.getValues().size() > 0) { @@ -111,7 +115,7 @@ public class FlowRunDocument implements TimelineDocument { baseMetric.getId()); } } else { - this.metrics.put(metricId, metricSubDocMap.get(metricId)); + this.metrics.put(metricId, metricValue); } } } @@ -135,7 +139,8 @@ public class FlowRunDocument implements TimelineDocument { baseMetric = TimelineMetricOperation.REPLACE .aggregate(incomingMetric, baseMetric, null); default: - //NoOP + LOG.warn("Unknown TimelineMetricOperation: {}", + baseMetric.getRealtimeAggregationOp()); } return baseMetric; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/reader/cosmosdb/CosmosDBDocumentStoreReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/reader/cosmosdb/CosmosDBDocumentStoreReader.java index 64468ac456f..834ebd55aee 100755 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/reader/cosmosdb/CosmosDBDocumentStoreReader.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/reader/cosmosdb/CosmosDBDocumentStoreReader.java @@ -49,7 +49,7 @@ public class CosmosDBDocumentStoreReader .getLogger(CosmosDBDocumentStoreReader.class); private static final int DEFAULT_DOCUMENTS_SIZE = 1; - private static DocumentClient client; + private static volatile DocumentClient client; private final String databaseName; private final static String COLLECTION_LINK = "/dbs/%s/colls/%s"; private final static String SELECT_TOP_FROM_COLLECTION = "SELECT TOP %d * " + diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/writer/cosmosdb/CosmosDBDocumentStoreWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/writer/cosmosdb/CosmosDBDocumentStoreWriter.java index b345276b679..16ed207be9e 100755 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/writer/cosmosdb/CosmosDBDocumentStoreWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/src/main/java/org/apache/hadoop/yarn/server/timelineservice/documentstore/writer/cosmosdb/CosmosDBDocumentStoreWriter.java @@ -51,7 +51,7 @@ public class CosmosDBDocumentStoreWriter private static final Logger LOG = LoggerFactory .getLogger(CosmosDBDocumentStoreWriter.class); - private static DocumentClient client; + private static volatile DocumentClient client; private final String databaseName; private static final PerNodeAggTimelineCollectorMetrics METRICS = PerNodeAggTimelineCollectorMetrics.getInstance();