mirror of https://github.com/apache/druid.git
moved profiler
This commit is contained in:
parent
34a9525966
commit
8e4fba431c
|
@ -22,7 +22,9 @@ package com.metamx.druid.master;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.metamx.druid.client.DataSegment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomBalancerStrategy implements BalancerStrategy
|
||||
{
|
||||
|
@ -33,7 +35,8 @@ public class RandomBalancerStrategy implements BalancerStrategy
|
|||
DataSegment proposalSegment, Iterable<ServerHolder> serverHolders
|
||||
)
|
||||
{
|
||||
return sampler.getRandomServerHolder(Lists.newArrayList(serverHolders));
|
||||
ArrayList<ServerHolder> serverHoldersList = Lists.newArrayList(serverHolders);
|
||||
return serverHoldersList.get(new Random().nextInt(serverHoldersList.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,20 +47,4 @@ public class ReservoirSegmentSampler
|
|||
}
|
||||
return new BalancerSegmentHolder(fromServerHolder.getServer(), proposalSegment);
|
||||
}
|
||||
|
||||
|
||||
public ServerHolder getRandomServerHolder(final List<ServerHolder> serverHolders)
|
||||
{
|
||||
ServerHolder serverHolder = null;
|
||||
int numSoFar = 0;
|
||||
for (ServerHolder server : serverHolders) {
|
||||
int randNum = rand.nextInt(numSoFar + 1);
|
||||
|
||||
if (randNum == numSoFar) {
|
||||
serverHolder = server;
|
||||
}
|
||||
numSoFar++;
|
||||
}
|
||||
return serverHolder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.metamx.druid.master;
|
||||
package com.metamx.druid.utils;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -7,6 +7,14 @@ import com.google.common.collect.Maps;
|
|||
import com.google.common.collect.MinMaxPriorityQueue;
|
||||
import com.metamx.druid.client.DataSegment;
|
||||
import com.metamx.druid.client.DruidServer;
|
||||
import com.metamx.druid.master.DruidCluster;
|
||||
import com.metamx.druid.master.DruidMaster;
|
||||
import com.metamx.druid.master.DruidMasterBalancerTester;
|
||||
import com.metamx.druid.master.DruidMasterRuntimeParams;
|
||||
import com.metamx.druid.master.LoadPeonCallback;
|
||||
import com.metamx.druid.master.LoadQueuePeon;
|
||||
import com.metamx.druid.master.LoadQueuePeonTester;
|
||||
import com.metamx.druid.master.ServerHolder;
|
||||
import com.metamx.druid.shard.NoneShardSpec;
|
||||
import org.easymock.EasyMock;
|
||||
import org.joda.time.DateTime;
|
Loading…
Reference in New Issue