Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 11f2eaa
Author: dmitry.golitsyn <[email protected]>
Date:   Tue Jun 27 21:15:42 2017 +0300

    Replace putIfAbsent with computeIfAbsent in DruidBalancer

commit 574587b
Author: dmitry.golitsyn <[email protected]>
Date:   Tue Jun 27 16:01:25 2017 +0300

    Do not remove segment that should not be moved from currentlyMovingSegments (segments are removed by callbacks or not inserted)

commit 7a261c8
Author: Jihoon Son <[email protected]>
Date:   Tue Jun 27 10:51:48 2017 +0900

    Split travis test (apache#4468)

commit 05d5868
Author: Roman Leventov <[email protected]>
Date:   Mon Jun 26 15:21:39 2017 -0500

    Remove the ability to create segments in v8 format (apache#4420)

    * Remove ability to create segments in v8 format

    * Fix IndexGeneratorJobTest

    * Fix parameterized test name in IndexMergerTest

    * Remove extra legacy merging stuff

    * Remove legacy serializer builders

    * Remove ConciseBitmapIndexMergerTest and RoaringBitmapIndexMergerTest
Do not remove segment that should not be moved from currentlyMovingSegments (segments are removed by callbacks or not inserted)

Replace putIfAbsent with computeIfAbsent in DruidBalancer
  • Loading branch information
dgolitsyn authored and leventov committed Jul 19, 2017
1 parent f97e4ef commit 10d6285
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package io.druid.server.coordinator.helper;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.MinMaxPriorityQueue;
import com.metamx.emitter.EmittingLogger;
import io.druid.client.ImmutableDruidServer;
Expand Down Expand Up @@ -58,7 +57,8 @@ public int compare(ServerHolder lhs, ServerHolder rhs)

protected final DruidCoordinator coordinator;

protected final Map<String, ConcurrentHashMap<String, BalancerSegmentHolder>> currentlyMovingSegments = Maps.newHashMap();
protected final Map<String, ConcurrentHashMap<String, BalancerSegmentHolder>> currentlyMovingSegments =
new ConcurrentHashMap<>();

public DruidCoordinatorBalancer(
DruidCoordinator coordinator
Expand Down Expand Up @@ -91,7 +91,8 @@ public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params)
params.getDruidCluster().getHistoricals().entrySet()) {
String tier = entry.getKey();

Map<String, BalancerSegmentHolder> tierMovingSegments = currentlyMovingSegments.computeIfAbsent(tier, key -> new ConcurrentHashMap<>());
Map<String, BalancerSegmentHolder> tierMovingSegments =
currentlyMovingSegments.computeIfAbsent(tier, t -> new ConcurrentHashMap<>());

final int numberOfMovingSegments = tierMovingSegments.size();

Expand Down Expand Up @@ -206,8 +207,6 @@ public void execute()
callback.execute();
}
}
} else {
currentlyMovingSegments.get(toServer.getTier()).remove(segmentName);
}
return false;
}
Expand Down
Loading

0 comments on commit 10d6285

Please sign in to comment.