Skip to content

Commit

Permalink
HBASE-22510 Address findbugs/spotbugs complaints (branch-1) (#278)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Busbey <busbey@apache.org>
  • Loading branch information
apurtell authored Jun 3, 2019
1 parent 7611cc1 commit eae7126
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public byte[] encodeData() {
}
BufferGrabbingByteArrayOutputStream stream = new BufferGrabbingByteArrayOutputStream();
baos.writeTo(stream);
this.dataBlockEncoder.endBlockEncoding(encodingCtx, out, stream.getOurBytes());
this.dataBlockEncoder.endBlockEncoding(encodingCtx, out, stream.toByteArray());
} catch (IOException e) {
throw new RuntimeException(String.format(
"Bug in encoding part of algorithm %s. " +
Expand All @@ -268,14 +268,15 @@ public byte[] encodeData() {
private static class BufferGrabbingByteArrayOutputStream extends ByteArrayOutputStream {
private byte[] ourBytes;

private synchronized byte[] getOurBytes() {
return ourBytes;
}

@Override
public synchronized void write(byte[] b, int off, int len) {
this.ourBytes = b;
}

@Override
public synchronized byte[] toByteArray() {
return ourBytes;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,7 @@ public List<String> listNamespaces() throws IOException {
}
}
if (cpHost != null) {
bypass = cpHost.postListNamespaces(namespaces);
cpHost.postListNamespaces(namespaces);
}
return namespaces;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,10 @@ private void applyThrottle(final Quotas.Builder quotas, final ThrottleRequest re
case READ_SIZE:
if (req.hasTimedQuota()) {
throttle.setReadSize(req.getTimedQuota());
} else {
throttle.clearReadSize();
}
} else {
throttle.clearReadSize();
}
break;
case REQUEST_CAPACITY_UNIT:
if (req.hasTimedQuota()) {
throttle.setReqCapacityUnit(req.getTimedQuota());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7959,7 +7959,9 @@ public Result append(Append mutate, long nonceGroup, long nonce) throws IOExcept
for (Map.Entry<Store, List<Cell>> entry: removedCellsForMemStore.entrySet()) {
entry.getKey().add(entry.getValue());
}
if (we != null) mvcc.complete(we);
if (we != null) {
mvcc.complete(we);
}
} else if (we != null) {
mvcc.completeAndWait(we);
}
Expand Down Expand Up @@ -8180,16 +8182,21 @@ private Result doIncrement(Increment increment, long nonceGroup, long nonce) thr
rowLock.release();
}
// if the wal sync was unsuccessful, remove keys from memstore
WriteEntry we = walKey != null ? walKey.getWriteEntry() : null;
if (doRollBackMemstore) {
for (Map.Entry<Store, List<Cell>> entry: forMemStore.entrySet()) {
rollbackMemstore(entry.getKey(), entry.getValue());
}
for (Map.Entry<Store, List<Cell>> entry: removedCellsForMemStore.entrySet()) {
entry.getKey().add(entry.getValue());
}
if (walKey != null) mvcc.complete(walKey.getWriteEntry());
if (we != null) {
mvcc.complete(we);
}
} else {
if (walKey != null) mvcc.completeAndWait(walKey.getWriteEntry());
if (we != null) {
mvcc.completeAndWait(we);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2796,10 +2796,14 @@ private void removeCompactedfiles(Collection<StoreFile> compactedfiles)
// Just close and return
filesToRemove.add(file);
} else {
LOG.info("Can't archive compacted file " + file.getPath()
if (r != null) {
LOG.info("Can't archive compacted file " + file.getPath()
+ " because of either isCompactedAway=" + r.isCompactedAway()
+ " or file has reference, isReferencedInReads=" + r.isReferencedInReads()
+ ", refCount=" + r.getRefCount() + ", skipping for now.");
} else {
LOG.info("Can't archive compacted file " + file.getPath() + ", skipping for now.");
}
}
} catch (Exception e) {
LOG.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
public class MajorCompactor extends Configured implements Tool {

private static final Logger LOG = LoggerFactory.getLogger(MajorCompactor.class);
protected static final Set<MajorCompactionRequest> ERRORS = Sets.newHashSet();
static final Set<MajorCompactionRequest> ERRORS = Sets.newHashSet();

protected ClusterCompactionQueues clusterCompactionQueues;
private long timestamp;
Expand Down

0 comments on commit eae7126

Please sign in to comment.