public void put(G g) { final String key = toKey(g.getDatanodeInfo().getDatanodeUuid(), g.storageType); final StorageGroup existing = map.put(key, g); Preconditions.checkState(existing == null); }
private boolean isGoodBlockCandidateForPlacementPolicy(StorageGroup source, StorageGroup target, DBlock block) { List<DatanodeInfo> datanodeInfos = new ArrayList<>(); synchronized (block) { for (StorageGroup loc : block.locations) { datanodeInfos.add(loc.getDatanodeInfo()); } datanodeInfos.add(target.getDatanodeInfo()); } return placementPolicies.getPolicy(BlockType.CONTIGUOUS).isMovable( datanodeInfos, source.getDatanodeInfo(), target.getDatanodeInfo()); }
NetUtils.createSocketAddr(target.getDatanodeInfo(). getXferAddr(Dispatcher.this.connectToDnViaHostname)), HdfsConstants.READ_TIMEOUT); new StorageType[]{target.storageType}, new String[0]); IOStreamPair saslStreams = saslClient.socketSend(sock, unbufOut, unbufIn, km, accessToken, target.getDatanodeInfo()); unbufOut = saslStreams.out; unbufIn = saslStreams.in;
boolean chooseTarget(DBlock db, Source source, List<StorageType> targetTypes, Matcher matcher) { final NetworkTopology cluster = dispatcher.getCluster(); for (StorageType t : targetTypes) { final List<StorageGroup> targets = storages.getTargetStorages(t); Collections.shuffle(targets); for (StorageGroup target : targets) { if (matcher.match(cluster, source.getDatanodeInfo(), target.getDatanodeInfo())) { final PendingMove pm = source.addPendingMove(db, target); if (pm != null) { dispatcher.executePendingMove(pm); return true; } } } } return false; } }
/** * Check if there are any replica (other than source) on the same node group * with target. If true, then target is not a good candidate for placing * specific replica as we don't want 2 replicas under the same nodegroup. * * @return true if there are any replica (other than source) on the same node * group with target */ private boolean isOnSameNodeGroupWithReplicas(StorageGroup source, StorageGroup target, DBlock block) { final DatanodeInfo targetDn = target.getDatanodeInfo(); for (StorageGroup g : block.getLocations()) { if (g != source && cluster.isOnSameNodeGroup(g.getDatanodeInfo(), targetDn)) { return true; } } return false; }
/** * Check if there are any replica (other than source) on the same node group * with target. If true, then target is not a good candidate for placing * specific replica as we don't want 2 replicas under the same nodegroup. * * @return true if there are any replica (other than source) on the same node * group with target */ private boolean isOnSameNodeGroupWithReplicas(StorageGroup source, StorageGroup target, DBlock block) { final DatanodeInfo targetDn = target.getDatanodeInfo(); for (StorageGroup g : block.getLocations()) { if (g != source && cluster.isOnSameNodeGroup(g.getDatanodeInfo(), targetDn)) { return true; } } return false; }
@Override public int hashCode() { return getStorageType().hashCode() ^ getDatanodeInfo().hashCode(); }
@Override public int hashCode() { return getStorageType().hashCode() ^ getDatanodeInfo().hashCode(); }
public void put(G g) { final String key = toKey(g.getDatanodeInfo().getDatanodeUuid(), g.storageType); final StorageGroup existing = map.put(key, g); Preconditions.checkState(existing == null); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null || !(obj instanceof StorageGroup)) { return false; } else { final StorageGroup that = (StorageGroup) obj; return this.getStorageType() == that.getStorageType() && this.getDatanodeInfo().equals(that.getDatanodeInfo()); } }
public void put(G g) { final String key = toKey(g.getDatanodeInfo().getDatanodeUuid(), g.storageType); final StorageGroup existing = map.put(key, g); Preconditions.checkState(existing == null); }
private boolean matchStorageGroups(StorageGroup left, StorageGroup right, Matcher matcher) { return left.getStorageType() == right.getStorageType() && matcher.match(dispatcher.getCluster(), left.getDatanodeInfo(), right.getDatanodeInfo()); }
private boolean matchStorageGroups(StorageGroup left, StorageGroup right, Matcher matcher) { return left.getStorageType() == right.getStorageType() && matcher.match(dispatcher.getCluster(), left.getDatanodeInfo(), right.getDatanodeInfo()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null || !(obj instanceof StorageGroup)) { return false; } else { final StorageGroup that = (StorageGroup) obj; return this.getStorageType() == that.getStorageType() && this.getDatanodeInfo().equals(that.getDatanodeInfo()); } }
final DatanodeInfo targetDN = target.getDatanodeInfo(); if (cluster.isOnSameNodeGroup(loc.getDatanodeInfo(), targetDN) && addTo(loc)) { return true; if (cluster.isOnSameRack(loc.getDatanodeInfo(), targetDN) && addTo(loc)) { return true;
return false; final DatanodeInfo targetDatanode = target.getDatanodeInfo(); if (source.getDatanodeInfo().equals(targetDatanode)) { if (blockLocation.getDatanodeInfo().equals(targetDatanode)) { return false;
boolean chooseTarget(DBlock db, Source source, List<StorageType> targetTypes, Matcher matcher) { final NetworkTopology cluster = dispatcher.getCluster(); for (StorageType t : targetTypes) { final List<StorageGroup> targets = storages.getTargetStorages(t); Collections.shuffle(targets); for (StorageGroup target : targets) { if (matcher.match(cluster, source.getDatanodeInfo(), target.getDatanodeInfo())) { final PendingMove pm = source.addPendingMove(db, target); if (pm != null) { dispatcher.executePendingMove(pm); return true; } } } } return false; } }
@Override public int hashCode() { return getStorageType().hashCode() ^ getDatanodeInfo().hashCode(); }
private boolean matchStorageGroups(StorageGroup left, StorageGroup right, Matcher matcher) { return left.getStorageType() == right.getStorageType() && matcher.match(dispatcher.getCluster(), left.getDatanodeInfo(), right.getDatanodeInfo()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null || !(obj instanceof StorageGroup)) { return false; } else { final StorageGroup that = (StorageGroup) obj; return this.getStorageType() == that.getStorageType() && this.getDatanodeInfo().equals(that.getDatanodeInfo()); } }