mirror of https://github.com/apache/druid.git
fix exception catching logic of moving segments
This commit is contained in:
parent
8b480e55db
commit
9b4c3756ed
|
@ -156,27 +156,33 @@ public class DruidMasterBalancer implements DruidMasterHelper
|
||||||
(toServer.getSegment(segmentName) == null) &&
|
(toServer.getSegment(segmentName) == null) &&
|
||||||
new ServerHolder(toServer, toPeon).getAvailableSize() > segmentToMove.getSize()) {
|
new ServerHolder(toServer, toPeon).getAvailableSize() > segmentToMove.getSize()) {
|
||||||
log.info("Moving [%s] from [%s] to [%s]", segmentName, fromServerName, toServerName);
|
log.info("Moving [%s] from [%s] to [%s]", segmentName, fromServerName, toServerName);
|
||||||
|
|
||||||
|
LoadPeonCallback callback = null;
|
||||||
try {
|
try {
|
||||||
|
currentlyMovingSegments.get(toServer.getTier()).put(segmentName, segment);
|
||||||
|
callback = new LoadPeonCallback()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void execute()
|
||||||
|
{
|
||||||
|
Map<String, BalancerSegmentHolder> movingSegments = currentlyMovingSegments.get(toServer.getTier());
|
||||||
|
if (movingSegments != null) {
|
||||||
|
movingSegments.remove(segmentName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
master.moveSegment(
|
master.moveSegment(
|
||||||
fromServerName,
|
fromServerName,
|
||||||
toServerName,
|
toServerName,
|
||||||
segmentToMove.getIdentifier(),
|
segmentToMove.getIdentifier(),
|
||||||
new LoadPeonCallback()
|
callback
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void execute()
|
|
||||||
{
|
|
||||||
Map<String, BalancerSegmentHolder> movingSegments = currentlyMovingSegments.get(toServer.getTier());
|
|
||||||
if (movingSegments != null) {
|
|
||||||
movingSegments.remove(segmentName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
currentlyMovingSegments.get(toServer.getTier()).put(segmentName, segment);
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.makeAlert(e, String.format("[%s] : Moving exception", segmentName)).emit();
|
log.makeAlert(e, String.format("[%s] : Moving exception", segmentName)).emit();
|
||||||
|
if (callback != null) {
|
||||||
|
callback.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentlyMovingSegments.get(toServer.getTier()).remove(segmentName);
|
currentlyMovingSegments.get(toServer.getTier()).remove(segmentName);
|
||||||
|
|
Loading…
Reference in New Issue