Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions tez-dag/findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,8 @@
<Match>
<Class name="org.apache.tez.dag.app.DAGAppMaster"/>
<Or>
<Field name="context"/>
<Field name="clientAMHeartbeatTimeoutIntervalMillis"/>
<Field name="clientHandler"/>
<Field name="currentDAG"/>
<Field name="state"/>
<Field name="taskSchedulerManager"/>
<Field name="versionMismatch"/>
<Field name="versionMismatchDiagnostics"/>
<Field name="containers"/>
<Field name="currentRecoveryDataDir"/>
<Field name="execService"/>
<Field name="historyEventHandler"/>
<Field name="nodes"/>
<Field name="recoveryEnabled"/>
<Field name="isLocal"/>
<Field name="hadoopShim"/>
<Field name="containerLauncherManager"/>
<Field name="taskCommunicatorManager"/>
<Field name="lastDAGCompletionTime"/>
</Or>
<Bug pattern="IS2_INCONSISTENT_SYNC"/>
</Match>
Expand Down
94 changes: 46 additions & 48 deletions tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private long getAMGCTime() {
}

@Override
public synchronized void serviceInit(final Configuration conf) throws Exception {
protected void serviceInit(final Configuration conf) throws Exception {

this.amConf = conf;
initResourceCalculatorPlugins();
Expand Down Expand Up @@ -1923,7 +1923,7 @@ private DAGRecoveryData recoverDAG() throws IOException, TezException {
}

@Override
public synchronized void serviceStart() throws Exception {
public void serviceStart() throws Exception {
//start all the components
startServices();
super.serviceStart();
Expand Down Expand Up @@ -2115,57 +2115,55 @@ public void serviceStop() throws Exception {
if (isSession) {
sessionStopped.set(true);
}
synchronized (this) {
if (this.dagSubmissionTimer != null) {
this.dagSubmissionTimer.cancel();
}
if (this.clientAMHeartBeatTimeoutService != null) {
this.clientAMHeartBeatTimeoutService.shutdownNow();
}
// release all the held containers before stop services TEZ-2687
initiateStop();
stopServices();

// Given pre-emption, we should delete tez scratch dir only if unregister is
// successful
boolean deleteTezScratchData = this.amConf.getBoolean(
TezConfiguration.TEZ_AM_STAGING_SCRATCH_DATA_AUTO_DELETE,
TezConfiguration.TEZ_AM_STAGING_SCRATCH_DATA_AUTO_DELETE_DEFAULT);
LOG.debug("Checking whether tez scratch data dir should be deleted, deleteTezScratchData={}",
deleteTezScratchData);
if (deleteTezScratchData && this.taskSchedulerManager != null
&& this.taskSchedulerManager.hasUnregistered()) {
// Delete tez scratch data dir
if (this.tezSystemStagingDir != null) {
try {
this.appMasterUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
FileSystem fs = tezSystemStagingDir.getFileSystem(amConf);
boolean deletedStagingDir = fs.delete(tezSystemStagingDir, true);
if (!deletedStagingDir) {
LOG.warn("Failed to delete tez scratch data dir, path="
+ tezSystemStagingDir);
} else {
LOG.info("Completed deletion of tez scratch data dir, path="
+ tezSystemStagingDir);
}
return null;
if (this.dagSubmissionTimer != null) {
this.dagSubmissionTimer.cancel();
}
if (this.clientAMHeartBeatTimeoutService != null) {
this.clientAMHeartBeatTimeoutService.shutdownNow();
}
// release all the held containers before stop services TEZ-2687
initiateStop();
stopServices();

// Given pre-emption, we should delete tez scratch dir only if unregister is
// successful
boolean deleteTezScratchData = this.amConf.getBoolean(
TezConfiguration.TEZ_AM_STAGING_SCRATCH_DATA_AUTO_DELETE,
TezConfiguration.TEZ_AM_STAGING_SCRATCH_DATA_AUTO_DELETE_DEFAULT);
LOG.debug("Checking whether tez scratch data dir should be deleted, deleteTezScratchData={}",
deleteTezScratchData);
if (deleteTezScratchData && this.taskSchedulerManager != null
&& this.taskSchedulerManager.hasUnregistered()) {
// Delete tez scratch data dir
if (this.tezSystemStagingDir != null) {
try {
this.appMasterUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
FileSystem fs = tezSystemStagingDir.getFileSystem(amConf);
boolean deletedStagingDir = fs.delete(tezSystemStagingDir, true);
if (!deletedStagingDir) {
LOG.warn("Failed to delete tez scratch data dir, path="
+ tezSystemStagingDir);
} else {
LOG.info("Completed deletion of tez scratch data dir, path="
+ tezSystemStagingDir);
}
});
} catch (IOException e) {
// Best effort to delete tez scratch data dir
LOG.warn("Failed to delete tez scratch data dir", e);
}
return null;
}
});
} catch (IOException e) {
// Best effort to delete tez scratch data dir
LOG.warn("Failed to delete tez scratch data dir", e);
}
}
}

if (execService != null) {
execService.shutdownNow();
}

super.serviceStop();
if (execService != null) {
execService.shutdownNow();
}

super.serviceStop();
}

private class DagEventDispatcher implements EventHandler<DAGEvent> {
Expand Down