From 8cd2a737775ff11cc8db7ec2c229cdca803d40f7 Mon Sep 17 00:00:00 2001 From: bibinchundatt Date: Mon, 30 Jul 2018 23:25:19 +0530 Subject: [PATCH] YARN-8584. Several typos in Log Aggregation related classes. Contributed by Szilard Nemeth. (cherry picked from commit 2b39ad26984d641bad57db2cfcc0b7515ef95f46) --- .../AggregatedLogDeletionService.java | 4 +-- .../logaggregation/AggregatedLogFormat.java | 8 +++--- .../LogAggregationFileController.java | 6 ++--- .../ifile/IndexedFileAggregatedLogsBlock.java | 6 ++--- .../LogAggregationIndexedFileController.java | 26 +++++++++---------- .../tfile/LogAggregationTFileController.java | 2 +- .../TestAggregatedLogDeletionService.java | 6 ++--- .../logaggregation/AppLogAggregatorImpl.java | 2 +- .../logaggregation/LogAggregationService.java | 6 ++--- .../NMLogAggregationStatusTracker.java | 4 +-- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogDeletionService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogDeletionService.java index 562bd2c6f41..841b8708371 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogDeletionService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogDeletionService.java @@ -258,7 +258,7 @@ public class AggregatedLogDeletionService extends AbstractService { return; } setLogAggCheckIntervalMsecs(retentionSecs); - task = new LogDeletionTask(conf, retentionSecs, creatRMClient()); + task = new LogDeletionTask(conf, retentionSecs, createRMClient()); timer = new Timer(); timer.scheduleAtFixedRate(task, 0, checkIntervalMsecs); } @@ -281,7 +281,7 @@ public class AggregatedLogDeletionService extends AbstractService { // We have already marked ApplicationClientProtocol.getApplicationReport // as @Idempotent, it will automatically take care of RM restart/failover. @VisibleForTesting - protected ApplicationClientProtocol creatRMClient() throws IOException { + protected ApplicationClientProtocol createRMClient() throws IOException { return ClientRMProxy.createRMProxy(getConfig(), ApplicationClientProtocol.class); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java index 31ca4800acc..4be0ba5dd35 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java @@ -177,7 +177,7 @@ public class AggregatedLogFormat { * The set of log files that are older than retention policy that will * not be uploaded but ready for deletion. */ - private final Set obseleteRetentionLogFiles = new HashSet(); + private final Set obsoleteRetentionLogFiles = new HashSet(); // TODO Maybe add a version string here. Instead of changing the version of // the entire k-v format @@ -323,7 +323,7 @@ public class AggregatedLogFormat { // if log files are older than retention policy, do not upload them. // but schedule them for deletion. if(logRetentionContext != null && !logRetentionContext.shouldRetainLog()){ - obseleteRetentionLogFiles.addAll(candidates); + obsoleteRetentionLogFiles.addAll(candidates); candidates.clear(); return candidates; } @@ -395,9 +395,9 @@ public class AggregatedLogFormat { return info; } - public Set getObseleteRetentionLogFiles() { + public Set getObsoleteRetentionLogFiles() { Set path = new HashSet(); - for(File file: this.obseleteRetentionLogFiles) { + for(File file: this.obsoleteRetentionLogFiles) { path.add(new Path(file.getAbsolutePath())); } return path; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java index 5ac89e91f61..5d23d95058d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java @@ -115,16 +115,16 @@ public abstract class LogAggregationFileController { */ public void initialize(Configuration conf, String controllerName) { this.conf = conf; - int configuredRentionSize = conf.getInt( + int configuredRetentionSize = conf.getInt( YarnConfiguration.NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP, YarnConfiguration .DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP); - if (configuredRentionSize <= 0) { + if (configuredRetentionSize <= 0) { this.retentionSize = YarnConfiguration .DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP; } else { - this.retentionSize = configuredRentionSize; + this.retentionSize = configuredRetentionSize; } this.fileControllerName = controllerName; initInternal(conf); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/IndexedFileAggregatedLogsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/IndexedFileAggregatedLogsBlock.java index c53ffcc5ac9..4ef429d498b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/IndexedFileAggregatedLogsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/IndexedFileAggregatedLogsBlock.java @@ -187,8 +187,8 @@ public class IndexedFileAggregatedLogsBlock extends LogAggregationHtmlBlock { FSDataInputStream fsin = fileContext.open(thisNodeFile.getPath()); int bufferSize = 65536; for (IndexedFileLogMeta candidate : candidates) { - if (candidate.getLastModificatedTime() < startTime - || candidate.getLastModificatedTime() > endTime) { + if (candidate.getLastModifiedTime() < startTime + || candidate.getLastModifiedTime() > endTime) { continue; } byte[] cbuf = new byte[bufferSize]; @@ -205,7 +205,7 @@ public class IndexedFileAggregatedLogsBlock extends LogAggregationHtmlBlock { html.pre().__("\n\n").__(); html.p().__("Log Type: " + candidate.getFileName()).__(); html.p().__("Log Upload Time: " + Times.format( - candidate.getLastModificatedTime())).__(); + candidate.getLastModifiedTime())).__(); html.p().__("Log Length: " + Long.toString( logLength)).__(); long startIndex = start < 0 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java index a8ae06f876c..14d727f684e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java @@ -404,7 +404,7 @@ public class LogAggregationIndexedFileController meta.setStartIndex(outputStreamState.getStartPos()); meta.setFileSize(fileLength); } - meta.setLastModificatedTime(logFile.lastModified()); + meta.setLastModifiedTime(logFile.lastModified()); metas.add(meta); } logsMetaInThisCycle.addContainerLogMeta(containerId, metas); @@ -499,12 +499,12 @@ public class LogAggregationIndexedFileController .getRemoteNodeFileDir(conf, appId, logRequest.getAppOwner(), this.remoteRootLogDir, this.remoteRootLogDirSuffix); if (!nodeFiles.hasNext()) { - throw new IOException("There is no available log fils for " + throw new IOException("There is no available log file for " + "application:" + appId); } List allFiles = getAllNodeFiles(nodeFiles, appId); if (allFiles.isEmpty()) { - throw new IOException("There is no available log fils for " + throw new IOException("There is no available log file for " + "application:" + appId); } Map checkSumFiles = parseCheckSumFiles(allFiles); @@ -581,7 +581,7 @@ public class LogAggregationIndexedFileController decompressor, getFSInputBufferSize(conf)); LogToolUtils.outputContainerLog(candidate.getContainerId(), nodeName, candidate.getFileName(), candidate.getFileSize(), size, - Times.format(candidate.getLastModificatedTime()), + Times.format(candidate.getLastModifiedTime()), in, os, buf, ContainerLogAggregationType.AGGREGATED); byte[] b = aggregatedLogSuffix(candidate.getFileName()) .getBytes(Charset.forName("UTF-8")); @@ -618,12 +618,12 @@ public class LogAggregationIndexedFileController .getRemoteNodeFileDir(conf, appId, appOwner, this.remoteRootLogDir, this.remoteRootLogDirSuffix); if (!nodeFiles.hasNext()) { - throw new IOException("There is no available log fils for " + throw new IOException("There is no available log file for " + "application:" + appId); } List allFiles = getAllNodeFiles(nodeFiles, appId); if (allFiles.isEmpty()) { - throw new IOException("There is no available log fils for " + throw new IOException("There is no available log file for " + "application:" + appId); } Map checkSumFiles = parseCheckSumFiles(allFiles); @@ -660,7 +660,7 @@ public class LogAggregationIndexedFileController for (IndexedFileLogMeta aMeta : log.getValue()) { meta.addLogMeta(aMeta.getFileName(), Long.toString( aMeta.getFileSize()), - Times.format(aMeta.getLastModificatedTime())); + Times.format(aMeta.getLastModifiedTime())); } containersLogMeta.add(meta); } @@ -671,7 +671,7 @@ public class LogAggregationIndexedFileController logMeta.getContainerLogMeta(containerIdStr)) { meta.addLogMeta(log.getFileName(), Long.toString( log.getFileSize()), - Times.format(log.getLastModificatedTime())); + Times.format(log.getLastModifiedTime())); } containersLogMeta.add(meta); } @@ -1002,7 +1002,7 @@ public class LogAggregationIndexedFileController private String fileName; private long fileSize; private long fileCompressedSize; - private long lastModificatedTime; + private long lastModifiedTime; private long startIndex; public String getFileName() { @@ -1026,11 +1026,11 @@ public class LogAggregationIndexedFileController this.fileCompressedSize = fileCompressedSize; } - public long getLastModificatedTime() { - return lastModificatedTime; + public long getLastModifiedTime() { + return lastModifiedTime; } - public void setLastModificatedTime(long lastModificatedTime) { - this.lastModificatedTime = lastModificatedTime; + public void setLastModifiedTime(long lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; } public long getStartIndex() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java index a4f50d2ebda..f405e0341a1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java @@ -268,7 +268,7 @@ public class LogAggregationTFileController RemoteIterator nodeFiles = LogAggregationUtils .getRemoteNodeFileDir(conf, appId, appOwner); if (nodeFiles == null) { - throw new IOException("There is no available log fils for " + throw new IOException("There is no available log file for " + "application:" + appId); } while (nodeFiles.hasNext()) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogDeletionService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogDeletionService.java index 4e2d3027de3..f36ebf46e19 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogDeletionService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogDeletionService.java @@ -160,7 +160,7 @@ public class TestAggregatedLogDeletionService { AggregatedLogDeletionService deletionService = new AggregatedLogDeletionService() { @Override - protected ApplicationClientProtocol creatRMClient() + protected ApplicationClientProtocol createRMClient() throws IOException { try { return createMockRMClient(finishedApplications, @@ -262,7 +262,7 @@ public class TestAggregatedLogDeletionService { return conf; } @Override - protected ApplicationClientProtocol creatRMClient() + protected ApplicationClientProtocol createRMClient() throws IOException { try { return createMockRMClient(finishedApplications, null); @@ -353,7 +353,7 @@ public class TestAggregatedLogDeletionService { AggregatedLogDeletionService deletionSvc = new AggregatedLogDeletionService() { @Override - protected ApplicationClientProtocol creatRMClient() + protected ApplicationClientProtocol createRMClient() throws IOException { try { return createMockRMClient(finishedApplications, null); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AppLogAggregatorImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AppLogAggregatorImpl.java index c7e06ff73b7..08aaeb84ff4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AppLogAggregatorImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AppLogAggregatorImpl.java @@ -605,7 +605,7 @@ public class AppLogAggregatorImpl implements AppLogAggregator { // need to return files uploaded or older-than-retention clean up. return Sets.union(logValue.getCurrentUpLoadedFilesPath(), - logValue.getObseleteRetentionLogFiles()); + logValue.getObsoleteRetentionLogFiles()); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java index 4938939ae2b..dcc165fd1e2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java @@ -117,9 +117,9 @@ public class LogAggregationService extends AbstractService implements LOG.info("Log aggregation debug mode enabled. rollingMonitorInterval = " + rollingMonitorInterval); } else { - LOG.warn("rollingMonitorIntervall should be more than or equal to " - + MIN_LOG_ROLLING_INTERVAL + " seconds. Using " - + MIN_LOG_ROLLING_INTERVAL + " seconds instead."); + LOG.warn("rollingMonitorInterval should be more than or equal to {} " + + "seconds. Using {} seconds instead.", + MIN_LOG_ROLLING_INTERVAL, MIN_LOG_ROLLING_INTERVAL); this.rollingMonitorInterval = MIN_LOG_ROLLING_INTERVAL; } } else if (rollingMonitorInterval <= 0) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/logaggregation/tracker/NMLogAggregationStatusTracker.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/logaggregation/tracker/NMLogAggregationStatusTracker.java index 510d6d894e5..eb2aaf54a3d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/logaggregation/tracker/NMLogAggregationStatusTracker.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/logaggregation/tracker/NMLogAggregationStatusTracker.java @@ -110,7 +110,7 @@ public class NMLogAggregationStatusTracker extends CompositeService { LogAggregationStatus logAggregationStatus, long updateTime, String diagnosis, boolean finalized) { if (disabled) { - LOG.warn("The log aggregation is diabled. No need to update " + LOG.warn("The log aggregation is disabled. No need to update " + "the log aggregation status"); } // In NM, each application has exactly one appLogAggregator thread @@ -164,7 +164,7 @@ public class NMLogAggregationStatusTracker extends CompositeService { public List pullCachedLogAggregationReports() { List reports = new ArrayList<>(); if (disabled) { - LOG.warn("The log aggregation is diabled." + LOG.warn("The log aggregation is disabled." + "There is no cached log aggregation status."); return reports; }