imply-cheddar commented on code in PR #13114:
URL: https://github.com/apache/druid/pull/13114#discussion_r983078672
##########
server/src/main/java/org/apache/druid/server/coordinator/duty/BalanceSegments.java:
##########
@@ -293,26 +292,18 @@ protected boolean moveSegment(
new ServerHolder(toServer, toPeon).getAvailableSize() >
segmentToMove.getSize()) {
log.debug("Moving [%s] from [%s] to [%s]", segmentId,
fromServer.getName(), toServer.getName());
- LoadPeonCallback callback = null;
+ ConcurrentMap<SegmentId, BalancerSegmentHolder> movingSegments =
+ currentlyMovingSegments.get(toServer.getTier());
+ movingSegments.put(segmentId, segment);
+ final LoadPeonCallback callback = moveSuccess ->
movingSegments.remove(segmentId);
try {
- ConcurrentMap<SegmentId, BalancerSegmentHolder> movingSegments =
- currentlyMovingSegments.get(toServer.getTier());
- movingSegments.put(segmentId, segment);
- callback = () -> movingSegments.remove(segmentId);
- coordinator.moveSegment(
- params,
- fromServer,
- toServer,
- segmentToMove,
- callback
- );
+ coordinator
+ .moveSegment(params, fromServer, toServer, segmentToMove,
callback);
return true;
}
catch (Exception e) {
- log.makeAlert(e, StringUtils.format("[%s] : Moving exception",
segmentId)).emit();
- if (callback != null) {
- callback.execute();
- }
+ log.makeAlert(e, "[%s] : Moving exception", segmentId).emit();
+ callback.execute(false);
Review Comment:
Are these changes fixing something or just style? It looks like just style
trying to remove the null check from the callback by moving the work of
building it outside of the `try` is that correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]