HDFS-17800 Prevent observer node from returning partial block data for erasure coded files#7754
HDFS-17800 Prevent observer node from returning partial block data for erasure coded files#7754Kimahriman wants to merge 4 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
ced8b93 to
9acfff1
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
@jojochuang @xkrogen since you have reviewed similar fixes in the past |
|
🎊 +1 overall
This message was automatically generated. |
9acfff1 to
832aae2
Compare
|
🎊 +1 overall
This message was automatically generated. |
832aae2 to
f738948
Compare
|
🎊 +1 overall
This message was automatically generated. |
f738948 to
ba7594f
Compare
|
💔 -1 overall
This message was automatically generated. |
ba7594f to
9cacb5c
Compare
|
💔 -1 overall
This message was automatically generated. |
9cacb5c to
6d4b2f4
Compare
6d4b2f4 to
8db70bc
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
It would be better to extract the logic for calculating minBlocks into a unified method, for example named |
Good call, updated for both |
|
🎊 +1 overall
This message was automatically generated. |
|
Great job, after further thinking, when check EC data in |
|
Ah yeah didn't realize the indices could be duplicated, addressed that as well |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
Looks good to me! |
ZanderXu
left a comment
There was a problem hiding this comment.
Thanks @Kimahriman for your contribution.
Make sense to me.
Maybe you can split this MR to two MRs:
- The first MR correct EC checks for ObserverRead
- The second MR correct EC checks for safeMode, since I saw that some other methods missed safemode check, such as: getFileInfo. Maybe you can sort out all related cases and fix them together.
| } | ||
|
|
||
| if (block.isStriped()) { | ||
| LocatedStripedBlock stripedBlock = (LocatedStripedBlock) block; |
There was a problem hiding this comment.
LocatedStripedBlock stripedBlock = (LocatedStripedBlock) block;
// For erasure coded files, require enough data units to reconstruct
// the block, bounded by the number of cells in the block.
long numCells = (block.getBlockSize() - 1) / ecPolicy.getCellSize() + 1;
int minRequiredIndices = (int) Math.min(ecPolicy.getNumDataUnits(), numCells);
// Units can be over-replicated, so need to account for unique indices
byte[] blockIndices = stripedBlock.getBlockIndices();
boolean[] seenIndices = new boolean[ecPolicy.getNumDataUnits() + ecPolicy.getNumParityUnits()];
int uniqueIndexCount = 0;
for (byte idx : blockIndices) {
int index = idx & 0xFF;
if (!seenIndices[index]) {
seenIndices[index] = true;
if (++uniqueIndexCount >= minRequiredIndices) {
return true;
}
}
}
return false;
| return haEnabled && haContext != null && haContext.getState().getServiceState() == OBSERVER; | ||
| } | ||
|
|
||
| private boolean hasSufficientReplicas(LocatedBlock block, |
There was a problem hiding this comment.
hasSufficientBlockLocations
Description of PR
HDFS-17800
Follow up to HDFS-13924, HDFS-16732, and HDFS-17768, factor in erasure coding policy when determining if observer or safe mode nodes have enough blocks to successfully serve a request, as a single block may not be sufficient for an erasure coded block.
How was this patch tested?
Updated existing UTs to factor in erasure coding policy.
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?