You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Surendra Singh Lilhore (Jira)" <ji...@apache.org> on 2019/11/19 09:30:00 UTC
[jira] [Commented] (HDFS-14994) Optimize
LowRedundancyBlocks#chooseLowRedundancyBlocks()
[ https://issues.apache.org/jira/browse/HDFS-14994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977302#comment-16977302 ]
Surendra Singh Lilhore commented on HDFS-14994:
-----------------------------------------------
we can avoid break also by using QUEUE_WITH_CORRUPT_BLOCKS in loop condition.
{code:java}
for (; count < blocksToProcess && priority < QUEUE_WITH_CORRUPT_BLOCKS; priority++) {
// Go through all blocks that need reconstructions with current priority.
// Set the iterator to the first unprocessed block at this priority level
final Iterator<BlockInfo> i = priorityQueues.get(priority).getBookmark();
final List<BlockInfo> blocks = new LinkedList<>();
blocksToReconstruct.add(blocks);
// Loop through all remaining blocks in the list.
for(; count < blocksToProcess && i.hasNext(); count++) {
blocks.add(i.next());
}
}
if (priority == QUEUE_WITH_CORRUPT_BLOCKS) {
// Reset all bookmarks because there were no recently added blocks.
for (LightWeightLinkedSet<BlockInfo> q : priorityQueues) {
q.resetBookmark();
}
} {code}
> Optimize LowRedundancyBlocks#chooseLowRedundancyBlocks()
> --------------------------------------------------------
>
> Key: HDFS-14994
> URL: https://issues.apache.org/jira/browse/HDFS-14994
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: Lisheng Sun
> Priority: Major
> Attachments: HDFS-14994.001.patch
>
>
> when priority=QUEUE_WITH_CORRUPT_BLOCKS, it mean no block in needreplication need replica.
> in current code if use continue, there is one more invalid judgment (priority ==QUEUE_WITH_CORRUPT_BLOCKS).
> i think it should use break instread of continue.
> {code:java}
> */
> synchronized List<List<BlockInfo>> chooseLowRedundancyBlocks(
> int blocksToProcess) {
> final List<List<BlockInfo>> blocksToReconstruct = new ArrayList<>(LEVEL);
> int count = 0;
> int priority = 0;
> for (; count < blocksToProcess && priority < LEVEL; priority++) {
> if (priority == QUEUE_WITH_CORRUPT_BLOCKS) {
> // do not choose corrupted blocks.
> continue;
> }
> ...
>
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org