public class SimCloudManager extends Object implements SolrCloudManager
SolrCloudManager
.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FREE_DISK |
static long |
DEFAULT_IDX_SIZE_BYTES |
static int |
DEFAULT_TOTAL_DISK |
Constructor and Description |
---|
SimCloudManager(TimeSource timeSource)
Create a simulated cluster.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static SimCloudManager |
createCluster(ClusterState initialState,
TimeSource timeSource)
Create a cluster initialized from the provided cluster state.
|
static SimCloudManager |
createCluster(int numNodes,
TimeSource timeSource)
Create a cluster with the specified number of nodes.
|
static SimCloudManager |
createCluster(SolrCloudManager other,
TimeSource timeSource) |
static Map<String,Object> |
createNodeValues(String nodeName)
Create simulated node values (metrics) for a node.
|
String |
dumpClusterState(boolean withCollections) |
long |
getBackgroundTaskFailureCount()
Returns a total count of the number of tasks submitted to
submit(java.util.concurrent.Callable<T>) that have failed
with any throwable other then InteruptedException |
ClusterStateProvider |
getClusterStateProvider() |
DistribStateManager |
getDistribStateManager() |
DistributedQueueFactory |
getDistributedQueueFactory() |
LiveNodesSet |
getLiveNodesSet() |
SolrResourceLoader |
getLoader()
Get the instance of
SolrResourceLoader that is used by the cluster components. |
SolrMetricManager |
getMetricManager() |
NodeStateProvider |
getNodeStateProvider() |
ObjectCache |
getObjectCache() |
OverseerTriggerThread |
getOverseerTriggerThread()
Direct access to the current
OverseerTriggerThread |
Random |
getRandom()
Get the source of randomness (usually initialized by the test suite).
|
SimClusterStateProvider |
getSimClusterStateProvider() |
SimDistribStateManager |
getSimDistribStateManager() |
SimNodeStateProvider |
getSimNodeStateProvider() |
TimeSource |
getTimeSource() |
byte[] |
httpRequest(String url,
SolrRequest.METHOD method,
Map<String,String> headers,
String payload,
int timeout,
boolean followRedirects)
HTTP requests are not supported by this implementation.
|
SolrResponse |
request(SolrRequest req) |
String |
simAddNode()
Add a new node and initialize its node values (metrics).
|
void |
simClearSystemCollection()
Clear the (simulated) .system collection.
|
Map<String,Map<String,AtomicInteger>> |
simGetEventCounts() |
long |
simGetOpCount(String op)
Get the number of processed operations of a specified type.
|
Map<String,AtomicLong> |
simGetOpCounts()
Get the number and type of operations processed by this cluster.
|
SolrClient |
simGetSolrClient()
Get a
SolrClient implementation where calls are forwarded to this
instance of the cluster. |
List<SolrInputDocument> |
simGetSystemCollection()
Get the content of (simulated) .system collection.
|
SolrResponse |
simHandleSolrRequest(SolrRequest req)
Handler method for autoscaling requests.
|
void |
simRemoveNode(String nodeId,
boolean withValues)
Remove a node from the cluster.
|
void |
simRemoveRandomNodes(int number,
boolean withValues,
Random random)
Remove a number of randomly selected nodes
|
void |
simResetOpCounts() |
void |
simRestartOverseer(String killNodeId)
Simulate the effect of restarting Overseer leader - in this case this means closing the current
OverseerTriggerThread (and optionally killing a node) then starting a new
OverseerTriggerThread . |
void |
simSetUseSystemCollection(boolean useSystemCollection) |
<T> Future<T> |
submit(Callable<T> callable)
Submit a task to execute in a thread pool.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isClosed
public static int DEFAULT_FREE_DISK
public static int DEFAULT_TOTAL_DISK
public static long DEFAULT_IDX_SIZE_BYTES
public SimCloudManager(TimeSource timeSource) throws Exception
SimDistribStateManager
with non-shared root node.SimClusterStateProvider
SimNodeStateProvider
, where node values are automatically initialized when using
simAddNode()
method.GenericDistributedQueueFactory
that uses SimDistribStateManager
as its storage.AutoScalingHandler
for managing AutoScalingConfig.OverseerTriggerThread
for managing triggers and processing events.timeSource
- time source to use.Exception
public static SimCloudManager createCluster(int numNodes, TimeSource timeSource) throws Exception
numNodes
- number of nodes to createtimeSource
- time sourceException
public static SimCloudManager createCluster(ClusterState initialState, TimeSource timeSource) throws Exception
initialState
- existing cluster statetimeSource
- time sourceException
public static SimCloudManager createCluster(SolrCloudManager other, TimeSource timeSource) throws Exception
Exception
public static Map<String,Object> createNodeValues(String nodeName)
nodeName
- node name (eg. '127.0.0.1:10000_solr'). If null then a new node name will be
created using sequentially increasing port number.public String dumpClusterState(boolean withCollections) throws Exception
Exception
public SolrResourceLoader getLoader()
SolrResourceLoader
that is used by the cluster components.public Random getRandom()
public String simAddNode() throws Exception
Exception
public void simRemoveNode(String nodeId, boolean withValues) throws Exception
nodeId
- node idwithValues
- when true, remove also simulated node values. If false
then node values are retained to later simulate
a node that comes back upException
public void simRemoveRandomNodes(int number, boolean withValues, Random random) throws Exception
number
- number of nodes to removewithValues
- when true, remove also simulated node values. If false
then node values are retained to later simulate
a node that comes back uprandom
- randomException
public void simSetUseSystemCollection(boolean useSystemCollection)
public void simClearSystemCollection()
public List<SolrInputDocument> simGetSystemCollection()
public Map<String,Map<String,AtomicInteger>> simGetEventCounts()
public SolrClient simGetSolrClient()
SolrClient
implementation where calls are forwarded to this
instance of the cluster.public void simRestartOverseer(String killNodeId) throws Exception
OverseerTriggerThread
(and optionally killing a node) then starting a new
OverseerTriggerThread
.
All background tasks currently in progress will be interrupted.killNodeId
- optional nodeId to kill. If null then don't kill any node, just restart the threadException
getOverseerTriggerThread()
public <T> Future<T> submit(Callable<T> callable)
callable
- task to executegetBackgroundTaskFailureCount()
public long getBackgroundTaskFailureCount()
submit(java.util.concurrent.Callable<T>)
that have failed
with any throwable other then InteruptedException
submit(java.util.concurrent.Callable<T>)
public SimClusterStateProvider getSimClusterStateProvider()
public SimNodeStateProvider getSimNodeStateProvider()
public SimDistribStateManager getSimDistribStateManager()
public LiveNodesSet getLiveNodesSet()
public Map<String,AtomicLong> simGetOpCounts()
public void simResetOpCounts()
public long simGetOpCount(String op)
op
- operation name, eg. MOVEREPLICApublic SolrMetricManager getMetricManager()
public ObjectCache getObjectCache()
getObjectCache
in interface SolrCloudManager
public TimeSource getTimeSource()
getTimeSource
in interface SolrCloudManager
public ClusterStateProvider getClusterStateProvider()
getClusterStateProvider
in interface SolrCloudManager
public NodeStateProvider getNodeStateProvider()
getNodeStateProvider
in interface SolrCloudManager
public DistribStateManager getDistribStateManager()
getDistribStateManager
in interface SolrCloudManager
public DistributedQueueFactory getDistributedQueueFactory()
getDistributedQueueFactory
in interface SolrCloudManager
public SolrResponse request(SolrRequest req) throws IOException
request
in interface SolrCloudManager
IOException
public SolrResponse simHandleSolrRequest(SolrRequest req) throws IOException, InterruptedException
req
- autoscaling requestIOException
InterruptedException
public byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String,String> headers, String payload, int timeout, boolean followRedirects) throws IOException
httpRequest
in interface SolrCloudManager
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public OverseerTriggerThread getOverseerTriggerThread()
OverseerTriggerThread
simRestartOverseer(java.lang.String)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.