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