Revert "HDFS-11696. Fix warnings from Spotbugs in hadoop-hdfs. Contributed by Yiqun Lin."

This reverts commit 89a8edc014.

 Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
This commit is contained in:
Andrew Wang 2017-06-29 13:54:16 -07:00
parent 5a75f73893
commit 441378e7e4
9 changed files with 33 additions and 62 deletions

View File

@ -2883,12 +2883,9 @@ private void initThreadsNumForStripedReads(int numThreads) {
}
synchronized (DFSClient.class) {
if (STRIPED_READ_THREAD_POOL == null) {
// Only after thread pool is fully constructed then save it to
// volatile field.
ThreadPoolExecutor threadPool = DFSUtilClient.getThreadPoolExecutor(1,
STRIPED_READ_THREAD_POOL = DFSUtilClient.getThreadPoolExecutor(1,
numThreads, 60, "StripedRead-", true);
threadPool.allowCoreThreadTimeOut(true);
STRIPED_READ_THREAD_POOL = threadPool;
STRIPED_READ_THREAD_POOL.allowCoreThreadTimeOut(true);
}
}
}

View File

@ -101,9 +101,8 @@ public boolean equals(Object o) {
}
boolean areEqual;
for (Map.Entry<String, Map<DiskOp, Double>> entry : this.slowDisks
.entrySet()) {
if (!entry.getValue().equals(that.slowDisks.get(entry.getKey()))) {
for (String disk : this.slowDisks.keySet()) {
if (!this.slowDisks.get(disk).equals(that.slowDisks.get(disk))) {
return false;
}
}

View File

@ -252,9 +252,4 @@
<Class name="org.apache.hadoop.hdfs.server.datanode.checker.AbstractFuture" />
<Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT" />
</Match>
<Match>
<Class name="org.apache.hadoop.hdfs.server.namenode.NNUpgradeUtil$1" />
<Method name="visitFile" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
</FindBugsFilter>

View File

@ -299,8 +299,6 @@ public boolean accept(File file) {
return file.isDirectory();
}
});
if (journalDirs != null) {
for (File journalDir : journalDirs) {
String jid = journalDir.getName();
if (!status.containsKey(jid)) {
@ -309,8 +307,6 @@ public boolean accept(File file) {
status.put(jid, jMap);
}
}
}
return JSON.toString(status);
}

View File

@ -190,8 +190,6 @@ public NamenodeRole toNodeRole() {
}
public void setClusterId(String cid) {
Preconditions.checkState(this == UPGRADE || this == UPGRADEONLY
|| this == FORMAT);
clusterId = cid;
}
@ -216,7 +214,6 @@ public MetaRecoveryContext createRecoveryContext() {
}
public void setForce(int force) {
Preconditions.checkState(this == RECOVER);
this.force = force;
}
@ -229,7 +226,6 @@ public boolean getForceFormat() {
}
public void setForceFormat(boolean force) {
Preconditions.checkState(this == FORMAT);
isForceFormat = force;
}
@ -238,7 +234,6 @@ public boolean getInteractiveFormat() {
}
public void setInteractiveFormat(boolean interactive) {
Preconditions.checkState(this == FORMAT);
isInteractiveFormat = interactive;
}

View File

@ -1336,15 +1336,11 @@ public boolean accept(File dir, String name) {
return name.startsWith(BLOCK_SUBDIR_PREFIX);
}
});
if (otherNames != null) {
for (int i = 0; i < otherNames.length; i++) {
for(int i = 0; i < otherNames.length; i++)
linkBlocksHelper(new File(from, otherNames[i]),
new File(to, otherNames[i]), oldLV, hl, upgradeToIdBasedLayout,
blockRoot, idBasedLayoutSingleLinks);
}
}
}
/**
* Get the BlockPoolSliceStorage from {@link bpStorageMap}.

View File

@ -255,14 +255,12 @@ public boolean accept(File dir, String name) {
});
// Check whether there is any work to do.
if (filesInStorage != null
&& filesInStorage.length <= numCheckpointsToRetain) {
if (filesInStorage.length <= numCheckpointsToRetain) {
return;
}
// Create a sorted list of txids from the file names.
TreeSet<Long> sortedTxIds = new TreeSet<Long>();
if (filesInStorage != null) {
for (String fName : filesInStorage) {
// Extract the transaction id from the file name.
long fTxId;
@ -276,7 +274,6 @@ public boolean accept(File dir, String name) {
}
sortedTxIds.add(Long.valueOf(fTxId));
}
}
int numFilesToDelete = sortedTxIds.size() - numCheckpointsToRetain;
Iterator<Long> iter = sortedTxIds.iterator();

View File

@ -1977,7 +1977,7 @@ public int run(String[] argv) throws Exception {
return exitCode;
}
} else if ("-report".equals(cmd)) {
if (argv.length > 6) {
if (argv.length < 1) {
printUsage(cmd);
return exitCode;
}
@ -2007,7 +2007,7 @@ public int run(String[] argv) throws Exception {
return exitCode;
}
} else if (RollingUpgradeCommand.matches(cmd)) {
if (argv.length > 2) {
if (argv.length < 1 || argv.length > 2) {
printUsage(cmd);
return exitCode;
}
@ -2082,7 +2082,7 @@ public int run(String[] argv) throws Exception {
return exitCode;
}
} else if ("-triggerBlockReport".equals(cmd)) {
if ((argv.length != 2) && (argv.length != 3)) {
if (argv.length < 1) {
printUsage(cmd);
return exitCode;
}

View File

@ -722,13 +722,9 @@ private void processINode(DataInputStream in, ImageVisitor v,
if (supportSnapshot && supportInodeId) {
dirNodeMap.put(inodeId, pathName);
}
v.visit(ImageElement.NS_QUOTA, in.readLong());
if (NameNodeLayoutVersion.supports(Feature.DISKSPACE_QUOTA,
imageVersion)) {
v.visit(ImageElement.DS_QUOTA, in.readLong());
}
v.visit(ImageElement.NS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
if (NameNodeLayoutVersion.supports(Feature.DISKSPACE_QUOTA, imageVersion))
v.visit(ImageElement.DS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
if (supportSnapshot) {
boolean snapshottable = in.readBoolean();
if (!snapshottable) {