-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDFS-17401. EC: Excess internal block may not be able to be deleted correctly when it's stored in fallback storage #6597
Open
RuinanGu
wants to merge
11
commits into
apache:trunk
Choose a base branch
from
RuinanGu:HDFS-17401
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+77
−14
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b46bfa
Delete exess internal block correctly.
RuinanGu 547083f
Fix TestTestReconstructStripedBlocks import
RuinanGu d1b3fbb
Fix uppercase issue
RuinanGu a5e2fe4
Fix checkstyle
RuinanGu f02b16d
Remove logEmptyExcessType
RuinanGu 91bac30
Remove log
RuinanGu 3c6c7d2
Modify TestReconstructStripedBlocks
RuinanGu 1fdac01
Fix TestReconstructionStripedBlocks
RuinanGu 5eba3db
Modify UT
RuinanGu 299e710
Remove useless import
RuinanGu 4448529
Fix UT and checkstyle
RuinanGu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
import org.apache.hadoop.hdfs.protocol.LocatedBlocks; | ||
import org.apache.hadoop.hdfs.protocol.LocatedStripedBlock; | ||
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies; | ||
import org.apache.hadoop.hdfs.protocol.HdfsConstants; | ||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; | ||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped; | ||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager; | ||
|
@@ -575,5 +576,78 @@ public void testReconstructionWithStorageTypeNotEnough() throws Exception { | |
cluster.shutdown(); | ||
} | ||
} | ||
@Test | ||
public void testDeleteOverReplicatedStripedBlock() throws Exception { | ||
final HdfsConfiguration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_INTERVAL_SECONDS_KEY, 1); | ||
conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_CONSIDERLOAD_KEY, | ||
false); | ||
StorageType[][] st = new StorageType[groupSize + 2][1]; | ||
for (int i = 0; i < st.length-1; i++){ | ||
st[i] = new StorageType[]{StorageType.SSD}; | ||
} | ||
st[st.length -1] = new StorageType[]{StorageType.DISK}; | ||
|
||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(groupSize + 2) | ||
.storagesPerDatanode(1) | ||
.storageTypes(st) | ||
.build(); | ||
cluster.waitActive(); | ||
DistributedFileSystem fs = cluster.getFileSystem(); | ||
fs.enableErasureCodingPolicy( | ||
StripedFileTestUtil.getDefaultECPolicy().getName()); | ||
try { | ||
fs.mkdirs(dirPath); | ||
fs.setErasureCodingPolicy(dirPath, | ||
StripedFileTestUtil.getDefaultECPolicy().getName()); | ||
fs.setStoragePolicy(dirPath, HdfsConstants.ALLSSD_STORAGE_POLICY_NAME); | ||
DFSTestUtil.createFile(fs, filePath, | ||
cellSize * dataBlocks * 2, (short) 1, 0L); | ||
// Stop a dn | ||
LocatedBlocks blks = fs.getClient().getLocatedBlocks(filePath.toString(), 0); | ||
LocatedStripedBlock block = (LocatedStripedBlock) blks.getLastLocatedBlock(); | ||
DatanodeInfo dnToStop = block.getLocations()[0]; | ||
|
||
MiniDFSCluster.DataNodeProperties dnProp = | ||
cluster.stopDataNode(dnToStop.getXferAddr()); | ||
cluster.setDataNodeDead(dnToStop); | ||
|
||
// Wait for reconstruction to happen | ||
DFSTestUtil.waitForReplication(fs, filePath, groupSize, 15 * 1000); | ||
|
||
DatanodeInfo dnToStop2 = block.getLocations()[1]; | ||
cluster.stopDataNode(dnToStop2.getXferAddr()); | ||
cluster.setDataNodeDead(dnToStop2); | ||
DFSTestUtil.waitForReplication(fs, filePath, groupSize, 15 * 1000); | ||
|
||
// Bring the dn back: 10 internal blocks now | ||
cluster.restartDataNode(dnProp); | ||
DFSTestUtil.verifyClientStats(conf, cluster); | ||
|
||
// Currently namenode is able to track the missing block. And restart NN | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here why need restart namenode?
Maybe update this logic to avoid using |
||
for (DataNode dn : cluster.getDataNodes()) { | ||
DataNodeTestUtils.triggerBlockReport(dn); | ||
} | ||
BlockManager bm = cluster.getNamesystem().getBlockManager(); | ||
Thread.sleep(3000); | ||
GenericTestUtils.waitFor(() -> | ||
bm.getPendingDeletionBlocksCount() == 0, 10, 2000); | ||
for (DataNode dn : cluster.getDataNodes()) { | ||
DataNodeTestUtils.triggerHeartbeat(dn); | ||
} | ||
boolean isDeletedRedundantBlock = true; | ||
blks = fs.getClient().getLocatedBlocks(filePath.toString(), 0); | ||
block = (LocatedStripedBlock) blks.getLastLocatedBlock(); | ||
BitSet bitSet = new BitSet(groupSize); | ||
for (byte index : block.getBlockIndices()) { | ||
if(bitSet.get(index)){ | ||
isDeletedRedundantBlock = false; | ||
} | ||
bitSet.set(index); | ||
} | ||
assertTrue(isDeletedRedundantBlock); | ||
} finally { | ||
cluster.shutdown(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here may be add
cluster.stopDataNode(dnToStop2.getXferAddr());