HDFS-9245. Fix findbugs warnings in hdfs-nfs/WriteCtx. Contributed by Mingliang Liu.
This commit is contained in:
parent
a06e6b81e0
commit
6e4562b844
|
@ -98,7 +98,7 @@ class WriteCtx {
|
||||||
*/
|
*/
|
||||||
private int trimDelta;
|
private int trimDelta;
|
||||||
|
|
||||||
public int getOriginalCount() {
|
public synchronized int getOriginalCount() {
|
||||||
return originalCount;
|
return originalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ class WriteCtx {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resized write should not allow dump
|
// Resized write should not allow dump
|
||||||
Preconditions.checkState(originalCount == INVALID_ORIGINAL_COUNT);
|
Preconditions.checkState(getOriginalCount() == INVALID_ORIGINAL_COUNT);
|
||||||
|
|
||||||
this.raf = raf;
|
this.raf = raf;
|
||||||
dumpFileOffset = dumpOut.getChannel().position();
|
dumpFileOffset = dumpOut.getChannel().position();
|
||||||
|
@ -193,6 +193,13 @@ class WriteCtx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the offset field
|
||||||
|
*/
|
||||||
|
private synchronized long getPlainOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
int getCount() {
|
int getCount() {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
// See comment "Overlapping Write Request Handling" above
|
// See comment "Overlapping Write Request Handling" above
|
||||||
|
@ -253,8 +260,8 @@ class WriteCtx {
|
||||||
try {
|
try {
|
||||||
dataBuffer = getData();
|
dataBuffer = getData();
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
LOG.error("Failed to get request data offset:" + offset + " count:"
|
LOG.error("Failed to get request data offset:" + getPlainOffset() + " " +
|
||||||
+ count + " error:" + e1);
|
"count:" + count + " error:" + e1);
|
||||||
throw new IOException("Can't get WriteCtx.data");
|
throw new IOException("Can't get WriteCtx.data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,8 +318,9 @@ class WriteCtx {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Id:" + handle.getFileId() + " offset:" + offset + " count:" + count
|
return "Id:" + handle.getFileId() + " offset:" + getPlainOffset() + " " +
|
||||||
+ " originalCount:" + originalCount + " stableHow:" + stableHow
|
"count:" + count + " originalCount:" + getOriginalCount() +
|
||||||
+ " replied:" + replied + " dataState:" + dataState + " xid:" + xid;
|
" stableHow:" + stableHow + " replied:" + replied + " dataState:" +
|
||||||
|
dataState + " xid:" + xid;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2290,6 +2290,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-9364. Unnecessary DNS resolution attempts when creating NameNodeProxies.
|
HDFS-9364. Unnecessary DNS resolution attempts when creating NameNodeProxies.
|
||||||
(Xiao Chen via zhz)
|
(Xiao Chen via zhz)
|
||||||
|
|
||||||
|
HDFS-9245. Fix findbugs warnings in hdfs-nfs/WriteCtx.
|
||||||
|
(Mingliang Liu via xyao)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
Loading…
Reference in New Issue