HBASE-14100 Fix high priority findbugs warnings

This commit is contained in:
zhangduo 2015-07-16 21:43:47 +08:00
parent 9ebafe6b08
commit 257df19cc3
7 changed files with 13 additions and 16 deletions

View File

@ -27,6 +27,7 @@ import static org.apache.hadoop.hbase.master.SplitLogManager.TerminationStatus.S
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -300,7 +301,8 @@ public class SplitLogManager {
FileStatus[] files = fs.listStatus(logDir); FileStatus[] files = fs.listStatus(logDir);
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
LOG.warn("Returning success without actually splitting and " LOG.warn("Returning success without actually splitting and "
+ "deleting all the log files in path " + logDir + ": " + files, ioe); + "deleting all the log files in path " + logDir + ": "
+ Arrays.toString(files), ioe);
} else { } else {
LOG.warn("Unable to delete log src dir. Ignoring. " + logDir, ioe); LOG.warn("Unable to delete log src dir. Ignoring. " + logDir, ioe);
} }

View File

@ -150,7 +150,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
// is more high priority normalization action than merge. // is more high priority normalization action than merge.
if (largestRegion.getSecond() > 2 * avgRegionSize) { if (largestRegion.getSecond() > 2 * avgRegionSize) {
LOG.debug("Table " + table + ", largest region " LOG.debug("Table " + table + ", largest region "
+ largestRegion.getFirst().getRegionName() + " has size " + largestRegion.getFirst().getRegionNameAsString() + " has size "
+ largestRegion.getSecond() + ", more than 2 times than avg size, splitting"); + largestRegion.getSecond() + ", more than 2 times than avg size, splitting");
return new SplitNormalizationPlan(largestRegion.getFirst(), null); return new SplitNormalizationPlan(largestRegion.getFirst(), null);
} else { } else {

View File

@ -53,11 +53,13 @@ public class AverageIntervalRateLimiter extends RateLimiter {
// This method is for strictly testing purpose only // This method is for strictly testing purpose only
@VisibleForTesting @VisibleForTesting
@Override
public void setNextRefillTime(long nextRefillTime) { public void setNextRefillTime(long nextRefillTime) {
this.nextRefillTime = nextRefillTime; this.nextRefillTime = nextRefillTime;
} }
@VisibleForTesting @VisibleForTesting
@Override
public long getNextRefillTime() { public long getNextRefillTime() {
return this.nextRefillTime; return this.nextRefillTime;
} }

View File

@ -45,11 +45,13 @@ public class FixedIntervalRateLimiter extends RateLimiter {
// This method is for strictly testing purpose only // This method is for strictly testing purpose only
@VisibleForTesting @VisibleForTesting
@Override
public void setNextRefillTime(long nextRefillTime) { public void setNextRefillTime(long nextRefillTime) {
this.nextRefillTime = nextRefillTime; this.nextRefillTime = nextRefillTime;
} }
@VisibleForTesting @VisibleForTesting
@Override
public long getNextRefillTime() { public long getNextRefillTime() {
return this.nextRefillTime; return this.nextRefillTime;
} }

View File

@ -198,13 +198,10 @@ public abstract class RateLimiter {
return (amount <= avail) ? 0 : getWaitInterval(limit, avail, amount); return (amount <= avail) ? 0 : getWaitInterval(limit, avail, amount);
} }
// This method is for strictly testing purpose only // These two method are for strictly testing purpose only
@VisibleForTesting @VisibleForTesting
public void setNextRefillTime(long nextRefillTime) { public abstract void setNextRefillTime(long nextRefillTime);
this.setNextRefillTime(nextRefillTime);
}
public long getNextRefillTime() { @VisibleForTesting
return this.getNextRefillTime(); public abstract long getNextRefillTime();
}
} }

View File

@ -192,11 +192,6 @@ public final class BloomFilterUtil {
return bbf; return bbf;
} }
/** Should only be used in tests */
public static boolean contains(byte[] buf, int offset, int length, ByteBuffer bloom) {
return contains(buf, offset, length, bloom);
}
public static boolean contains(byte[] buf, int offset, int length, public static boolean contains(byte[] buf, int offset, int length,
ByteBuffer bloomBuf, int bloomOffset, int bloomSize, Hash hash, ByteBuffer bloomBuf, int bloomOffset, int bloomSize, Hash hash,
int hashCount) { int hashCount) {

View File

@ -1227,8 +1227,7 @@ public class WALSplitter {
} }
} }
controller.checkForErrors(); controller.checkForErrors();
LOG.info((this.writerThreads == null? 0: this.writerThreads.size()) + LOG.info(this.writerThreads.size() + " split writers finished; closing...");
" split writers finished; closing...");
return (!progress_failed); return (!progress_failed);
} }