Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-22509 Address findbugs/spotbugs complaints (branch-1.4) #277

Merged
merged 1 commit into from
Jun 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.ourBytes);
this.dataBlockEncoder.endBlockEncoding(encodingCtx, out, stream.toByteArray());
} catch (IOException e) {
throw new RuntimeException(String.format(
"Bug in encoding part of algorithm %s. " +
Expand All @@ -272,6 +272,11 @@ private static class BufferGrabbingByteArrayOutputStream extends ByteArrayOutput
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 @@ -48,7 +48,7 @@ public void stop() {

private enum ExecutorSingleton {
INSTANCE;
private final ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
private transient final ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
new ThreadPoolExecutorThreadFactory("HBase-Metrics2-"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7963,7 +7963,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) {
Copy link
Contributor Author

@apurtell apurtell May 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are a carrying forward of formatting changes from the branch-1.3 changes proposed on HBASE-22508 (#275). They don't address a findbugs issue, only try to keep the code as consistent as possible between branches.

mvcc.complete(we);
}
} else if (we != null) {
mvcc.completeAndWait(we);
}
Expand Down Expand Up @@ -8184,16 +8186,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 @@ -2836,10 +2836,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