[
https://issues.apache.org/jira/browse/HDFS-8319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14558978#comment-14558978
]
Walter Su commented on HDFS-8319:
---------------------------------
1.
{code}
int len = (int) (rangeEndInBlockGroup - rangeStartInBlockGroup + 1);
{code}
it should be {{long}}. For pread the value maybe huge.
2.
{code}
cells[numCells - 1] = cells[0];
{code}
Can be removed.
3.
{code}
long cellStart = cell.idxInInternalBlk * cellSize + cell.offset;
{code}
evaluated value is {{int}}, casting is useless. Should be
{code}
long cellStart = 1L * cell.idxInInternalBlk * cellSize + cell.offset;
{code}
4.
{code}
for (AlignedStripe stripe : stripes) {
// Parse group to get chosen DN location
LocatedBlock[] blks = StripedBlockUtil.parseStripedBlockGroup(blockGroup,
cellSize, dataBlkNum, parityBlkNum);
{code}
should move it out of {{for}} scope.
5.
{code}
if (alignedStripe.getSpanInBlock() == 0) {
return;
}
{code}
Useless, should be removed. It'll never be 0. Use assertion instead to prevent
programmatic mistake.
6.
{code}
if (future != null) {
future.get();
{code}
We knew it's completed. So get() is useless.
7.
{code}
581 while (!futures.isEmpty()) {
...
593 if (r.state == StripingChunkReadResult.SUCCESSFUL) {
...
600 } else {
601 returnedChunk.state = StripingChunk.MISSING;
...
609 prepareDecodeInputs();
610 // TODO: close the failed block reader
611 for (int i = 0; i < alignedStripe.chunks.length; i++) {
612 StripingChunk chunk = alignedStripe.chunks[i];
613 Preconditions.checkNotNull(chunk);
614 if (chunk.state == StripingChunk.REQUESTED && i <=
dataBlkNum) {
615 readChunk(service, blocks[i], i, corruptedBlockMap);
616 }
617 }
{code}
We already have a data trunk missing, we should read parity trunk. So need to
remove {{i<=dataBlkNum}} in line 614.
More serious problem is, If the 3rd future failed, and the following futures
are SUCCESSFUL. The following futures save data to {{curStripeBuf}} and do not
copy again to {{decodeInputs}}. {{decodeInputs}} lost valuable data which could
be used to decode.
The problem is, you only call {{prepareDecodeInputs}} *once*, and only copy
{{curStripeBuf}} to {{decodeInputs}} *once*.
8.
{code}
if (alignedStripe.missingChunksNum > 0) {
decode();
}
{code}
Need to copy the decoded result back.
> Erasure Coding: support decoding for stateful read
> --------------------------------------------------
>
> Key: HDFS-8319
> URL: https://issues.apache.org/jira/browse/HDFS-8319
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: Jing Zhao
> Assignee: Jing Zhao
> Attachments: HDFS-8319.001.patch
>
>
> HDFS-7678 adds the decoding functionality for pread. This jira plans to add
> decoding to stateful read.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)