Skip to content
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

ISSUE-64. Hadoop 3.0 NN drops replicas silently. #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
import java.io.OutputStream;
import java.nio.channels.ClosedChannelException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
Expand Down Expand Up @@ -332,7 +334,19 @@ public boolean isOnTransientStorage() {
*/
private static class SimulatedBPStorage {
private long used; // in bytes
private final Map<Block, BInfo> blockMap = new HashMap<>();
private static final Comparator<Object> LONG_AND_BLOCK_COMPARATOR
= new Comparator<Object>() {

@Override
public int compare(Object o1, Object o2) {
long lookup = ((Block) o1).getBlockId();
long stored = ((Block) o2).getBlockId();
return Long.compare(lookup, stored);
}
};

private final Map<Block, BInfo> blockMap =
new TreeMap<>(LONG_AND_BLOCK_COMPARATOR);

long getUsed() {
return used;
Expand Down