HBASE-10011 Fix some findbugs in the client

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545210 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2013-11-25 10:22:30 +00:00
parent 81f21ca409
commit 35cea57fe5
7 changed files with 35 additions and 21 deletions

View File

@ -166,40 +166,40 @@ public class RegionLoad {
@Override
public String toString() {
StringBuilder sb = Strings.appendKeyValue(new StringBuilder(), "numberOfStores",
Integer.valueOf(this.getStores()));
this.getStores());
sb = Strings.appendKeyValue(sb, "numberOfStorefiles",
Integer.valueOf(this.getStorefiles()));
this.getStorefiles());
sb = Strings.appendKeyValue(sb, "storefileUncompressedSizeMB",
Integer.valueOf(this.getStoreUncompressedSizeMB()));
this.getStoreUncompressedSizeMB());
sb = Strings.appendKeyValue(sb, "storefileSizeMB",
Integer.valueOf(this.getStorefileSizeMB()));
this.getStorefileSizeMB());
if (this.getStoreUncompressedSizeMB() != 0) {
sb = Strings.appendKeyValue(sb, "compressionRatio",
String.format("%.4f", (float)this.getStorefileSizeMB()/
(float)this.getStoreUncompressedSizeMB()));
String.format("%.4f", (float) this.getStorefileSizeMB() /
(float) this.getStoreUncompressedSizeMB()));
}
sb = Strings.appendKeyValue(sb, "memstoreSizeMB",
Integer.valueOf(this.getMemStoreSizeMB()));
this.getMemStoreSizeMB());
sb = Strings.appendKeyValue(sb, "storefileIndexSizeMB",
Integer.valueOf(this.getStorefileIndexSizeMB()));
this.getStorefileIndexSizeMB());
sb = Strings.appendKeyValue(sb, "readRequestsCount",
Long.valueOf(this.getReadRequestsCount()));
this.getReadRequestsCount());
sb = Strings.appendKeyValue(sb, "writeRequestsCount",
Long.valueOf(this.getWriteRequestsCount()));
this.getWriteRequestsCount());
sb = Strings.appendKeyValue(sb, "rootIndexSizeKB",
Integer.valueOf(this.getRootIndexSizeKB()));
this.getRootIndexSizeKB());
sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB",
Integer.valueOf(this.getTotalStaticIndexSizeKB()));
this.getTotalStaticIndexSizeKB());
sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB",
Integer.valueOf(this.getTotalStaticBloomSizeKB()));
this.getTotalStaticBloomSizeKB());
sb = Strings.appendKeyValue(sb, "totalCompactingKVs",
Long.valueOf(this.getTotalCompactingKVs()));
this.getTotalCompactingKVs());
sb = Strings.appendKeyValue(sb, "currentCompactedKVs",
Long.valueOf(this.getCurrentCompactedKVs()));
this.getCurrentCompactedKVs());
float compactionProgressPct = Float.NaN;
if( this.getTotalCompactingKVs() > 0 ) {
compactionProgressPct = Float.valueOf(
this.getCurrentCompactedKVs() / this.getTotalCompactingKVs());
if (this.getTotalCompactingKVs() > 0) {
compactionProgressPct = ((float) this.getCurrentCompactedKVs() /
(float) this.getTotalCompactingKVs());
}
sb = Strings.appendKeyValue(sb, "compactionProgressPct",
compactionProgressPct);

View File

@ -463,6 +463,8 @@ public class HTableMultiplexer {
}
@Override
@edu.umd.cs.findbugs.annotations.SuppressWarnings
(value = "REC_CATCH_EXCEPTION", justification = "na")
public void run() {
List<PutStatus> processingList = new ArrayList<PutStatus>();
/**

View File

@ -125,7 +125,7 @@ public class Result implements CellScannable {
if (exists != null){
return new Result(null, exists);
}
return new Result(cells.toArray(new Cell[cells.size()]), exists);
return new Result(cells.toArray(new Cell[cells.size()]), null);
}
/**

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -97,6 +98,11 @@ public class RowMutations implements Row {
return false;
}
@Override
public int hashCode(){
return Arrays.hashCode(row);
}
@Override
public byte[] getRow() {
return row;

View File

@ -44,6 +44,8 @@ import com.google.protobuf.ServiceException;
* Dynamic rather than static so can set the generic appropriately.
*/
@InterfaceAudience.Private
@edu.umd.cs.findbugs.annotations.SuppressWarnings
(value = "IS2_INCONSISTENT_SYNC", justification = "na")
public class RpcRetryingCaller<T> {
static final Log LOG = LogFactory.getLog(RpcRetryingCaller.class);
/**
@ -102,6 +104,8 @@ public class RpcRetryingCaller<T> {
* @throws IOException if a remote or network exception occurs
* @throws RuntimeException other unspecified error
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings
(value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "na")
public synchronized T callWithRetries(RetryingCallable<T> callable, int callTimeout)
throws IOException, RuntimeException {
this.callTimeout = callTimeout;

View File

@ -44,6 +44,7 @@ public class NullComparator extends ByteArrayComparable {
}
@Override
@edu.umd.cs.findbugs.annotations.SuppressWarnings (value="EQ_UNUSUAL", justification="")
public boolean equals(Object obj) {
return obj == null;
}

View File

@ -1944,8 +1944,9 @@ public class ZKUtil {
ZooKeeperProtos.StoreSequenceId.Builder storeSequenceIdBuilder =
ZooKeeperProtos.StoreSequenceId.newBuilder();
if (storeSequenceIds != null) {
for (byte[] columnFamilyName : storeSequenceIds.keySet()) {
Long curSeqId = storeSequenceIds.get(columnFamilyName);
for (Map.Entry<byte[], Long> e : storeSequenceIds.entrySet()){
byte[] columnFamilyName = e.getKey();
Long curSeqId = e.getValue();
storeSequenceIdBuilder.setFamilyName(ZeroCopyLiteralByteString.wrap(columnFamilyName));
storeSequenceIdBuilder.setSequenceId(curSeqId);
regionSequenceIdsBuilder.addStoreSequenceId(storeSequenceIdBuilder.build());