bug fix for checking if a segment exists on a node

This commit is contained in:
Fangjin Yang 2012-12-07 15:16:34 -08:00
parent 9eb28254f8
commit 404f6322c6
2 changed files with 8 additions and 2 deletions

View File

@ -96,7 +96,7 @@ public class ServerHolder implements Comparable<ServerHolder>
public boolean containsSegment(DataSegment segment) public boolean containsSegment(DataSegment segment)
{ {
return (server.getSegment(segment.getIdentifier()) != null && peon.getSegmentsToLoad().contains(segment)); return (server.getSegment(segment.getIdentifier()) != null || peon.getSegmentsToLoad().contains(segment));
} }
@Override @Override

View File

@ -74,7 +74,13 @@ public abstract class LoadRule implements Rule
while (actualReplicants < expectedReplicants) { while (actualReplicants < expectedReplicants) {
ServerHolder holder = serverQueue.pollFirst(); ServerHolder holder = serverQueue.pollFirst();
if (holder == null) { if (holder == null) {
log.warn("Not enough %s servers[%d] to assign segments!!!", getTier(), serverQueue.size()); log.warn(
"Not enough %s servers[%d] to assign segment[%s]! Expected Replicants[%d]",
getTier(),
assignedServers.size() + serverQueue.size() + 1,
segment.getIdentifier(),
expectedReplicants
);
break; break;
} }
if (holder.containsSegment(segment)) { if (holder.containsSegment(segment)) {