HDFS-8294. Erasure Coding: Fix Findbug warnings present in erasure coding. Contributed by Rakesh R.
This commit is contained in:
parent
e53fa769c9
commit
7af05a3db4
|
@ -247,3 +247,6 @@
|
|||
|
||||
HDFS-8186. Erasure coding: Make block placement policy for EC file configurable.
|
||||
(Walter Su via zhz)
|
||||
|
||||
HDFS-8294. Erasure Coding: Fix Findbug warnings present in erasure coding.
|
||||
(Rakesh R via zhz)
|
||||
|
|
|
@ -276,11 +276,11 @@ public class DFSStripedOutputStream extends DFSOutputStream {
|
|||
return getCurrentStreamer().getIndex();
|
||||
}
|
||||
|
||||
StripedDataStreamer getCurrentStreamer() {
|
||||
private synchronized StripedDataStreamer getCurrentStreamer() {
|
||||
return (StripedDataStreamer)streamer;
|
||||
}
|
||||
|
||||
private StripedDataStreamer setCurrentStreamer(int i) {
|
||||
private synchronized StripedDataStreamer setCurrentStreamer(int i) {
|
||||
streamer = streamers.get(i);
|
||||
return getCurrentStreamer();
|
||||
}
|
||||
|
@ -344,8 +344,8 @@ public class DFSStripedOutputStream extends DFSOutputStream {
|
|||
int ckOff = 0;
|
||||
while (byteBuffer.remaining() > 0) {
|
||||
DFSPacket p = createPacket(packetSize, chunksPerPacket,
|
||||
streamer.getBytesCurBlock(),
|
||||
streamer.getAndIncCurrentSeqno(), false);
|
||||
getCurrentStreamer().getBytesCurBlock(),
|
||||
getCurrentStreamer().getAndIncCurrentSeqno(), false);
|
||||
int maxBytesToPacket = p.getMaxChunks() * bytesPerChecksum;
|
||||
int toWrite = byteBuffer.remaining() > maxBytesToPacket ?
|
||||
maxBytesToPacket: byteBuffer.remaining();
|
||||
|
@ -353,7 +353,7 @@ public class DFSStripedOutputStream extends DFSOutputStream {
|
|||
p.writeChecksum(checksumBuf, ckOff, ckLen);
|
||||
ckOff += ckLen;
|
||||
p.writeData(byteBuffer, toWrite);
|
||||
streamer.incBytesCurBlock(toWrite);
|
||||
getCurrentStreamer().incBytesCurBlock(toWrite);
|
||||
packets.add(p);
|
||||
}
|
||||
return packets;
|
||||
|
@ -529,7 +529,7 @@ public class DFSStripedOutputStream extends DFSOutputStream {
|
|||
if (!current.isFailed()) {
|
||||
try {
|
||||
for (DFSPacket p : generatePackets(buffer, checksumBuf)) {
|
||||
streamer.waitAndQueuePacket(p);
|
||||
getCurrentStreamer().waitAndQueuePacket(p);
|
||||
}
|
||||
endBlock();
|
||||
} catch(Exception e) {
|
||||
|
|
|
@ -189,6 +189,9 @@ public class BlockInfoStripedUnderConstruction extends BlockInfoStriped
|
|||
NameNode.blockStateChangeLog.warn("BLOCK*" +
|
||||
" BlockInfoStripedUnderConstruction.initLeaseRecovery:" +
|
||||
" No blocks found, lease removed.");
|
||||
// sets primary node index and return.
|
||||
primaryNodeIndex = -1;
|
||||
return;
|
||||
}
|
||||
boolean allLiveReplicasTriedAsPrimary = true;
|
||||
for (ReplicaUnderConstruction replica : replicas) {
|
||||
|
|
|
@ -251,7 +251,7 @@ public final class ErasureCodingWorker {
|
|||
private final long[] blockOffset4Targets;
|
||||
private final long[] seqNo4Targets;
|
||||
|
||||
private final int WRITE_PACKET_SIZE = 64 * 1024;
|
||||
private final static int WRITE_PACKET_SIZE = 64 * 1024;
|
||||
private DataChecksum checksum;
|
||||
private int maxChunksPerPacket;
|
||||
private byte[] packetBuf;
|
||||
|
@ -904,7 +904,7 @@ public final class ErasureCodingWorker {
|
|||
}
|
||||
}
|
||||
|
||||
private class StripedReader {
|
||||
private static class StripedReader {
|
||||
private final short index;
|
||||
private BlockReader blockReader;
|
||||
private ByteBuffer buffer;
|
||||
|
|
|
@ -92,8 +92,8 @@ public class ErasureCodingZoneManager {
|
|||
String schemaName = WritableUtils.readString(dIn);
|
||||
ECSchema schema = dir.getFSNamesystem().getECSchemaManager()
|
||||
.getSchema(schemaName);
|
||||
return new ErasureCodingZoneInfo(inode.getFullPathName(), schema,
|
||||
cellSize);
|
||||
return new ErasureCodingZoneInfo(dir.getInode(inode.getId())
|
||||
.getFullPathName(), schema, cellSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class StripedBlockUtil {
|
|||
final ExtendedBlock blk = constructInternalBlock(
|
||||
bg.getBlock(), cellSize, dataBlkNum, idxInBlockGroup);
|
||||
|
||||
final long offset = bg.getStartOffset() + idxInBlockGroup * cellSize;
|
||||
final long offset = bg.getStartOffset() + idxInBlockGroup * (long) cellSize;
|
||||
if (idxInReturnedLocs < bg.getLocations().length) {
|
||||
return new LocatedBlock(blk,
|
||||
new DatanodeInfo[]{bg.getLocations()[idxInReturnedLocs]},
|
||||
|
@ -406,11 +406,11 @@ public class StripedBlockUtil {
|
|||
long earliestStart = startOffsets[firstCell.idxInStripe];
|
||||
for (int i = 1; i < dataBlkNum; i++) {
|
||||
int idx = firstCellIdxInBG + i;
|
||||
if (idx * cellSize >= blockGroup.getBlockSize()) {
|
||||
if (idx * (long) cellSize >= blockGroup.getBlockSize()) {
|
||||
break;
|
||||
}
|
||||
StripingCell cell = new StripingCell(ecSchema, cellSize, idx);
|
||||
startOffsets[cell.idxInStripe] = cell.idxInInternalBlk * cellSize;
|
||||
startOffsets[cell.idxInStripe] = cell.idxInInternalBlk * (long) cellSize;
|
||||
if (startOffsets[cell.idxInStripe] < earliestStart) {
|
||||
earliestStart = startOffsets[cell.idxInStripe];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue