You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2019/04/13 01:31:54 UTC

[hadoop] branch trunk updated: HADOOP-16237. Fix new findbugs issues after updating guava to 27.0-jre.

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

stevel 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 1943db5  HADOOP-16237. Fix new findbugs issues after updating guava to 27.0-jre.
1943db5 is described below

commit 1943db557124439f9f41c18a618455ccf4c3e6cc
Author: Gabor Bota <ga...@cloudera.com>
AuthorDate: Fri Apr 12 18:27:41 2019 -0700

    HADOOP-16237. Fix new findbugs issues after updating guava to 27.0-jre.
    
    Author:    Gabor Bota <ga...@cloudera.com>
---
 .../hadoop-kms/dev-support/findbugsExcludeFile.xml |  8 +++++
 .../hadoop-yarn/dev-support/findbugs-exclude.xml   | 37 ++++++++++++++++++++++
 .../document/entity/TimelineEntityDocument.java    | 22 +++++++++----
 .../document/flowrun/FlowRunDocument.java          | 13 +++++---
 .../cosmosdb/CosmosDBDocumentStoreReader.java      |  2 +-
 .../cosmosdb/CosmosDBDocumentStoreWriter.java      |  2 +-
 6 files changed, 71 insertions(+), 13 deletions(-)

diff --git a/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml b/hadoop-common-project/hadoop-kms/dev-support/findbugsExcludeFile.xml
index f864c03..356189b 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.
 -->
 <FindBugsFilter>
+
+  <!-- The called method signature is isNullOrEmpty(@Nullable String string) in guava 27, so this should be ignored. -->
+  <Match>
+    <Class name="org.apache.hadoop.crypto.key.kms.server.KMSAudit"/>
+    <Method name="op" />
+    <Bug pattern="NP_NULL_PARAM_DEREF"/>
+  </Match>
+
   <!--
     Findbug is complaining about System.out being NULL
   -->
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 dd42129..eaab7e3 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 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
 
+  <!-- The called method signature is String emptyToNull(@Nullable String string) in guava 27, so this should be ignored -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.server.nodemanager.NodeHealthCheckerService"/>
+    <Method name="getHealthReport" />
+    <Bug pattern="NP_NULL_PARAM_DEREF"/>
+  </Match>
+
+  <!-- The variable is not used, but it's defined for the document model. -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.server.timelineservice.documentstore.collection.document.entity.TimelineEventSubDoc"/>
+    <Method name="setValid" />
+    <Bug pattern="URF_UNREAD_FIELD"/>
+  </Match>
+
+  <!-- The variable is not used, but it's defined for the document model. -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.server.timelineservice.documentstore.collection.document.entity.TimelineMetricSubDoc"/>
+    <Method name="setValid" />
+    <Bug pattern="URF_UNREAD_FIELD"/>
+  </Match>
+
+  <!-- The called method signature is public boolean set(@Nullable V value) in guava 27, so this should be ignored -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore$UpdateAppTransition"/>
+    <Method name="transition" />
+    <Local name="result" />
+    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
+  </Match>
+
+  <!-- The called method signature is public boolean set(@Nullable V value) in guava 27, so this should be ignored -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler"/>
+    <Method name="updateApplicationPriority" />
+    <Local name="result" />
+    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
+  </Match>
+
 </FindBugsFilter>
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 ea72ee3..a0b42eb 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<String, Set<TimelineMetricSubDoc>> metrics) {
-    for (String metricId : metrics.keySet()) {
-      for(TimelineMetricSubDoc metricSubDoc : metrics.get(metricId)) {
+    for (Map.Entry<String, Set<TimelineMetricSubDoc>> metricEntry :
+        metrics.entrySet()) {
+      final String metricId = metricEntry.getKey();
+      final Set<TimelineMetricSubDoc> 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<String, Set<TimelineEventSubDoc>> events) {
-    for (String eventId : events.keySet()) {
-      for(TimelineEventSubDoc eventSubDoc: events.get(eventId)) {
+    for (Map.Entry<String, Set<TimelineEventSubDoc>> eventEntry :
+        events.entrySet()) {
+      final String eventId = eventEntry.getKey();
+      final Set<TimelineEventSubDoc> 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 8ee87ab..d131cf2 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<FlowRunDocument> {
 
   private void aggregateMetrics(
       Map<String, TimelineMetricSubDoc> metricSubDocMap) {
-    for(String metricId : metricSubDocMap.keySet()) {
+    for(Map.Entry<String, TimelineMetricSubDoc> 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<FlowRunDocument> {
               baseMetric.getId());
         }
       } else {
-        this.metrics.put(metricId, metricSubDocMap.get(metricId));
+        this.metrics.put(metricId, metricValue);
       }
     }
   }
@@ -135,7 +139,8 @@ public class FlowRunDocument implements TimelineDocument<FlowRunDocument> {
       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 64468ac..834ebd5 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<TimelineDoc extends TimelineDocument>
       .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 b345276..16ed207 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<TimelineDoc extends TimelineDocument>
   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();


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