TEZ-2727. Fix findbugs warnings. (sseth)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/ed5b460a Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/ed5b460a Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/ed5b460a Branch: refs/heads/TEZ-2003 Commit: ed5b460aecf939751b414029737e24a0d2c35a23 Parents: 0400fe0 Author: Siddharth Seth <[email protected]> Authored: Mon Aug 17 14:39:38 2015 -0700 Committer: Siddharth Seth <[email protected]> Committed: Thu Aug 20 18:24:24 2015 -0700 ---------------------------------------------------------------------- TEZ-2003-CHANGES.txt | 1 + tez-api/findbugs-exclude.xml | 18 +++++++++++ .../api/ServicePluginsDescriptor.java | 4 +-- tez-dag/findbugs-exclude.xml | 14 +++++++- .../dag/app/TaskCommunicatorContextImpl.java | 2 +- .../tez/dag/app/TezTaskCommunicatorImpl.java | 12 +++---- tez-ext-service-tests/findbugs-exclude.xml | 34 ++++++++++++++++++++ 7 files changed, 75 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/TEZ-2003-CHANGES.txt ---------------------------------------------------------------------- diff --git a/TEZ-2003-CHANGES.txt b/TEZ-2003-CHANGES.txt index fed203a..cd10a03 100644 --- a/TEZ-2003-CHANGES.txt +++ b/TEZ-2003-CHANGES.txt @@ -50,5 +50,6 @@ ALL CHANGES: TEZ-2713. Add tests for node handling when there's multiple schedulers. TEZ-2721. rebase 08/14 TEZ-2714. Fix comments from review - part 3. + TEZ-2727. Fix findbugs warnings INCOMPATIBLE CHANGES: http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-api/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/tez-api/findbugs-exclude.xml b/tez-api/findbugs-exclude.xml index 07792e6..dbb0db8 100644 --- a/tez-api/findbugs-exclude.xml +++ b/tez-api/findbugs-exclude.xml @@ -97,4 +97,22 @@ <Bug pattern="EI_EXPOSE_REP"/> </Match> + <Match> + <Class name="org.apache.tez.serviceplugins.api.ServicePluginsDescriptor" /> + <Method name="getTaskSchedulerDescriptors" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + + <Match> + <Class name="org.apache.tez.serviceplugins.api.ServicePluginsDescriptor" /> + <Method name="getContainerLauncherDescriptors" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + + <Match> + <Class name="org.apache.tez.serviceplugins.api.ServicePluginsDescriptor" /> + <Method name="getTaskCommunicatorDescriptors" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + </FindBugsFilter> http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-api/src/main/java/org/apache/tez/serviceplugins/api/ServicePluginsDescriptor.java ---------------------------------------------------------------------- diff --git a/tez-api/src/main/java/org/apache/tez/serviceplugins/api/ServicePluginsDescriptor.java b/tez-api/src/main/java/org/apache/tez/serviceplugins/api/ServicePluginsDescriptor.java index 2dabed0..39d2cb8 100644 --- a/tez-api/src/main/java/org/apache/tez/serviceplugins/api/ServicePluginsDescriptor.java +++ b/tez-api/src/main/java/org/apache/tez/serviceplugins/api/ServicePluginsDescriptor.java @@ -37,14 +37,14 @@ public class ServicePluginsDescriptor { private TaskCommunicatorDescriptor[] taskCommunicatorDescriptors; private ServicePluginsDescriptor(boolean enableContainers, boolean enableUber, - TaskSchedulerDescriptor[] taskSchedulerDescriptor, + TaskSchedulerDescriptor[] taskSchedulerDescriptors, ContainerLauncherDescriptor[] containerLauncherDescriptors, TaskCommunicatorDescriptor[] taskCommunicatorDescriptors) { this.enableContainers = enableContainers; this.enableUber = enableUber; Preconditions.checkArgument(taskSchedulerDescriptors == null || taskSchedulerDescriptors.length > 0, "TaskSchedulerDescriptors should either not be specified or at least 1 should be provided"); - this.taskSchedulerDescriptors = taskSchedulerDescriptor; + this.taskSchedulerDescriptors = taskSchedulerDescriptors; Preconditions.checkArgument(containerLauncherDescriptors == null || containerLauncherDescriptors.length > 0, "ContainerLauncherDescriptor should either not be specified or at least 1 should be provided"); this.containerLauncherDescriptors = containerLauncherDescriptors; http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-dag/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/tez-dag/findbugs-exclude.xml b/tez-dag/findbugs-exclude.xml index ab7ae5c..9d15035 100644 --- a/tez-dag/findbugs-exclude.xml +++ b/tez-dag/findbugs-exclude.xml @@ -18,6 +18,7 @@ <Or> <Field name="blacklistDisablePercent" /> <Field name="maxTaskFailuresPerNode" /> + <Field name="nodeBlacklistingEnabled" /> </Or> <Bug pattern="IS2_INCONSISTENT_SYNC" /> </Match> @@ -81,12 +82,23 @@ </Match> <Match> + <Class name="org.apache.tez.dag.app.rm.node.PerSourceNodeTracker" /> + <Bug pattern="BC_UNCONFIRMED_CAST"/> + </Match> + + <Match> <Class name="~org\.apache\.tez\.dag\.app\.rm\.TaskSchedulerEventHandler"/> <Bug pattern="BC_UNCONFIRMED_CAST"/> </Match> <Match> - <Class name="org.apache.tez.dag.app.rm.TaskSchedulerAppCallbackWrapper"/> + <Class name="org.apache.tez.dag.app.launcher.ContainerLauncherRouter" /> + <Method name="handle" params="org.apache.tez.dag.app.rm.NMCommunicatorEvent" returns="void" /> + <Bug pattern="BC_UNCONFIRMED_CAST" /> + </Match> + + <Match> + <Class name="org.apache.tez.dag.app.rm.TaskSchedulerContextImplWrapper"/> <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/> </Match> http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskCommunicatorContextImpl.java ---------------------------------------------------------------------- diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskCommunicatorContextImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskCommunicatorContextImpl.java index c56311c..9d57ac3 100644 --- a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskCommunicatorContextImpl.java +++ b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskCommunicatorContextImpl.java @@ -156,7 +156,7 @@ public class TaskCommunicatorContextImpl implements TaskCommunicatorContext, Ver Set<Vertex> sources = vertex.getInputVertices().keySet(); return Iterables.transform(sources, new Function<Vertex, String>() { @Override - public String apply(@Nullable Vertex input) { + public String apply(Vertex input) { return input.getName(); } }); http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-dag/src/main/java/org/apache/tez/dag/app/TezTaskCommunicatorImpl.java ---------------------------------------------------------------------- diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/TezTaskCommunicatorImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/TezTaskCommunicatorImpl.java index 9ecee5b..6c8e1e0 100644 --- a/tez-dag/src/main/java/org/apache/tez/dag/app/TezTaskCommunicatorImpl.java +++ b/tez-dag/src/main/java/org/apache/tez/dag/app/TezTaskCommunicatorImpl.java @@ -208,7 +208,7 @@ public class TezTaskCommunicatorImpl extends TaskCommunicator { if (containerInfo != null) { synchronized(containerInfo) { if (containerInfo.taskSpec != null && containerInfo.taskSpec.getTaskAttemptID() != null) { - attemptToContainerMap.remove(containerInfo.taskSpec.getTaskAttemptID()); + attemptToContainerMap.remove(new TaskAttempt(containerInfo.taskSpec.getTaskAttemptID())); } } } @@ -359,11 +359,12 @@ public class TezTaskCommunicatorImpl extends TaskCommunicator { } } - TaskHeartbeatResponse tResponse = null; + TezHeartbeatResponse response = new TezHeartbeatResponse(); TezTaskAttemptID taskAttemptID = request.getCurrentTaskAttemptID(); if (taskAttemptID != null) { + TaskHeartbeatResponse tResponse; synchronized (containerInfo) { ContainerId containerIdFromMap = attemptToContainerMap.get(new TaskAttempt(taskAttemptID)); if (containerIdFromMap == null || !containerIdFromMap.equals(containerId)) { @@ -382,12 +383,11 @@ public class TezTaskCommunicatorImpl extends TaskCommunicator { request.getCurrentTaskAttemptID(), request.getEvents(), request.getStartIndex(), request.getPreRoutedStartIndex(), request.getMaxEvents()); tResponse = getContext().heartbeat(tRequest); + response.setEvents(tResponse.getEvents()); + response.setNextFromEventId(tResponse.getNextFromEventId()); + response.setNextPreRoutedEventId(tResponse.getNextPreRoutedEventId()); } - TezHeartbeatResponse response = new TezHeartbeatResponse(); response.setLastRequestId(requestId); - response.setEvents(tResponse.getEvents()); - response.setNextFromEventId(tResponse.getNextFromEventId()); - response.setNextPreRoutedEventId(tResponse.getNextPreRoutedEventId()); containerInfo.lastRequestId = requestId; containerInfo.lastResponse = response; return response; http://git-wip-us.apache.org/repos/asf/tez/blob/ed5b460a/tez-ext-service-tests/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/tez-ext-service-tests/findbugs-exclude.xml b/tez-ext-service-tests/findbugs-exclude.xml new file mode 100644 index 0000000..32c7392 --- /dev/null +++ b/tez-ext-service-tests/findbugs-exclude.xml @@ -0,0 +1,34 @@ +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +--> +<FindBugsFilter> + + <Match> + <Class name="~org\.apache\.tez\.test\.service\.rpc\.TezTestServiceProtocolProtos\$.*Proto" /> + <Field name="unknownFields" /> + <Bug pattern="SE_BAD_FIELD" /> + </Match> + + <Match> + <Class name="~org\.apache\.tez\.test\.service\.rpc\.TezTestServiceProtocolProtos\$.*Proto" /> + <Field name="PARSER" /> + <Bug pattern="MS_SHOULD_BE_FINAL" /> + </Match> + + <Match> + <Class name="~org\.apache\.tez\.test\.service\.rpc\.TezTestServiceProtocolProtos\$.*Proto\$Builder" /> + <Method name="maybeForceBuilderInitialization" /> + <Bug pattern="UCF_USELESS_CONTROL_FLOW" /> + </Match> + +</FindBugsFilter>
