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,
AutoScalingConfig config,
TimeSource timeSource) |
static Map<String,Object> |
createNodeValues(String nodeName)
Create simulated node values (metrics) for a node.
|
void |
disableMetricsHistory() |
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, waitisClosedpublic 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.SimClusterStateProviderSimNodeStateProvider, 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.Exceptionpublic static SimCloudManager createCluster(int numNodes, TimeSource timeSource) throws Exception
numNodes - number of nodes to createtimeSource - time sourceExceptionpublic static SimCloudManager createCluster(ClusterState initialState, TimeSource timeSource) throws Exception
initialState - existing cluster statetimeSource - time sourceExceptionpublic static SimCloudManager createCluster(SolrCloudManager other, AutoScalingConfig config, TimeSource timeSource) throws Exception
Exceptionpublic 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 void disableMetricsHistory()
public String dumpClusterState(boolean withCollections) throws Exception
Exceptionpublic SolrResourceLoader getLoader()
SolrResourceLoader that is used by the cluster components.public Random getRandom()
public String simAddNode() throws Exception
Exceptionpublic 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 upExceptionpublic 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 - randomExceptionpublic 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 threadExceptiongetOverseerTriggerThread()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 InteruptedExceptionsubmit(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 SolrCloudManagerpublic TimeSource getTimeSource()
getTimeSource in interface SolrCloudManagerpublic ClusterStateProvider getClusterStateProvider()
getClusterStateProvider in interface SolrCloudManagerpublic NodeStateProvider getNodeStateProvider()
getNodeStateProvider in interface SolrCloudManagerpublic DistribStateManager getDistribStateManager()
getDistribStateManager in interface SolrCloudManagerpublic DistributedQueueFactory getDistributedQueueFactory()
getDistributedQueueFactory in interface SolrCloudManagerpublic SolrResponse request(SolrRequest req) throws IOException
request in interface SolrCloudManagerIOExceptionpublic SolrResponse simHandleSolrRequest(SolrRequest req) throws IOException, InterruptedException
req - autoscaling requestIOExceptionInterruptedExceptionpublic byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String,String> headers, String payload, int timeout, boolean followRedirects) throws IOException
httpRequest in interface SolrCloudManagerIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic OverseerTriggerThread getOverseerTriggerThread()
OverseerTriggerThreadsimRestartOverseer(java.lang.String)Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.