public class SimClusterStateProvider extends Object implements ClusterStateProvider
ClusterStateProvider
.
The following behaviors are supported:
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_DOC_SIZE_BYTES
Deprecated.
|
Constructor and Description |
---|
SimClusterStateProvider(LiveNodesSet liveNodes,
SimCloudManager cloudManager)
Deprecated.
The instance needs to be initialized using the
sim* methods in order
to ensure proper behavior, otherwise it will behave as a cluster with zero replicas. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
|
void |
connect()
Deprecated.
|
void |
copyFrom(ClusterStateProvider other)
Deprecated.
|
void |
createSystemCollection()
Deprecated.
|
Map<String,String> |
getAliasProperties(String alias)
Deprecated.
|
Map<String,Object> |
getClusterProperties()
Deprecated.
|
ClusterState |
getClusterState()
Deprecated.
|
Set<String> |
getLiveNodes()
Deprecated.
|
String |
getPolicyNameByCollection(String coll)
Deprecated.
|
ClusterState.CollectionRef |
getState(String collection)
Deprecated.
|
boolean |
isClosed()
Deprecated.
|
List<String> |
resolveAlias(String alias)
Deprecated.
|
void |
simAddNode(String nodeId)
Deprecated.
Add a new node to the cluster.
|
void |
simAddReplica(String nodeId,
ReplicaInfo replicaInfo,
boolean runLeaderElection)
Deprecated.
Add a replica.
|
void |
simAddReplica(ZkNodeProps message,
NamedList results)
Deprecated.
Add a new replica.
|
void |
simCreateCollection(ZkNodeProps props,
NamedList results)
Deprecated.
Create a new collection.
|
void |
simCreateShard(ZkNodeProps message,
NamedList results)
Deprecated.
Create a new shard.
|
void |
simDeleteAllCollections()
Deprecated.
Remove all collections.
|
void |
simDeleteCollection(String collection,
String async,
NamedList results)
Deprecated.
Delete a collection
|
void |
simDeleteShard(ZkNodeProps message,
NamedList results)
Deprecated.
Delete a shard.
|
Map<String,Map<String,Object>> |
simGetCollectionStats()
Deprecated.
|
String |
simGetOverseerLeader()
Deprecated.
|
String |
simGetRandomNode()
Deprecated.
Get random node id.
|
String |
simGetRandomNode(Random random)
Deprecated.
Get random node id.
|
ReplicaInfo |
simGetReplicaInfo(String collection,
String coreNode)
Deprecated.
|
List<ReplicaInfo> |
simGetReplicaInfos(String node)
Deprecated.
Return all replica infos for a node.
|
List<ReplicaInfo> |
simGetReplicaInfos(String collection,
String shard)
Deprecated.
|
List<String> |
simListCollections()
Deprecated.
List collections.
|
void |
simMoveReplica(ZkNodeProps message,
NamedList results)
Deprecated.
Move replica.
|
QueryResponse |
simQuery(QueryRequest req)
Deprecated.
|
void |
simRemoveDeadNodes()
Deprecated.
Remove all replica information related to dead nodes.
|
boolean |
simRemoveNode(String nodeId)
Deprecated.
Remove node from a cluster.
|
void |
simRemoveReplica(String nodeId,
String collection,
String coreNodeName)
Deprecated.
Remove replica.
|
void |
simResetLeaderThrottles()
Deprecated.
Reset the leader election throttles.
|
boolean |
simRestoreNode(String nodeId)
Deprecated.
Restore a previously removed node.
|
void |
simSetClusterProperties(Map<String,Object> properties)
Deprecated.
Set all cluster properties.
|
void |
simSetClusterProperty(String key,
Object value)
Deprecated.
Set a cluster property.
|
void |
simSetClusterState(ClusterState initialState)
Deprecated.
Initialize from an existing cluster state
|
void |
simSetCollectionProperties(String coll,
Map<String,Object> properties)
Deprecated.
Set collection properties.
|
void |
simSetCollectionProperty(String coll,
String key,
String value)
Deprecated.
Set collection property.
|
void |
simSetCollectionValue(String collection,
String key,
Object value)
Deprecated.
Set per-collection value (eg.
|
void |
simSetCollectionValue(String collection,
String key,
Object value,
boolean delta,
boolean divide)
Deprecated.
Set per-collection value (eg.
|
void |
simSetOpDelays(String collection,
Map<String,Long> delays)
Deprecated.
|
void |
simSetReplicaValues(String node,
Map<String,Map<String,List<ReplicaInfo>>> source,
boolean overwrite)
Deprecated.
|
void |
simSetShardValue(String collection,
String shard,
String key,
Object value)
Deprecated.
Set per-collection value (eg.
|
void |
simSetShardValue(String collection,
String shard,
String key,
Object value,
boolean delta,
boolean divide)
Deprecated.
Set per-collection value (eg.
|
void |
simSetSliceProperties(String coll,
String slice,
Map<String,Object> properties)
Deprecated.
Set slice properties.
|
void |
simSplitShard(ZkNodeProps message,
NamedList results)
Deprecated.
Split a shard.
|
UpdateResponse |
simUpdate(UpdateRequest req)
Deprecated.
Simulate an update by modifying replica metrics.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClusterProperty, getClusterProperty, getCollection, isRoutedAlias, resolveSimpleAlias
public static final long DEFAULT_DOC_SIZE_BYTES
public SimClusterStateProvider(LiveNodesSet liveNodes, SimCloudManager cloudManager) throws Exception
sim*
methods in order
to ensure proper behavior, otherwise it will behave as a cluster with zero replicas.Exception
public void copyFrom(ClusterStateProvider other) throws Exception
Exception
public void simSetClusterState(ClusterState initialState) throws Exception
initialState
- initial cluster stateException
public void simResetLeaderThrottles()
public String simGetRandomNode()
public String simGetRandomNode(Random random)
random
- instance of random.public void simAddNode(String nodeId) throws Exception
nodeId
- unique node idException
public boolean simRemoveNode(String nodeId) throws Exception
nodeId
- node idException
public void simRemoveDeadNodes() throws Exception
Exception
public String simGetOverseerLeader()
public boolean simRestoreNode(String nodeId) throws Exception
nodeId
- node id to restoreException
public void simAddReplica(ZkNodeProps message, NamedList results) throws Exception
message
- replica detailsresults
- result of the operationException
public void simAddReplica(String nodeId, ReplicaInfo replicaInfo, boolean runLeaderElection) throws Exception
nodeId
- node id where the replica will be addedreplicaInfo
- replica inforunLeaderElection
- if true then run a leader election after adding the replica.Exception
public void simRemoveReplica(String nodeId, String collection, String coreNodeName) throws Exception
nodeId
- node idcoreNodeName
- coreNodeNameException
public void simCreateCollection(ZkNodeProps props, NamedList results) throws Exception
props
- collection detailsresults
- results of the operation.Exception
public void simDeleteCollection(String collection, String async, NamedList results) throws Exception
collection
- collection nameasync
- async idresults
- results of the operationException
public void simDeleteAllCollections() throws Exception
Exception
public void simMoveReplica(ZkNodeProps message, NamedList results) throws Exception
MoveReplicaCmd
moveNormalReplica(...)
method.message
- operation detailsresults
- operation results.Exception
public void simCreateShard(ZkNodeProps message, NamedList results) throws Exception
CreateShardCmd
.message
- operation detailsresults
- operation resultsException
public void simSplitShard(ZkNodeProps message, NamedList results) throws Exception
SplitShardCmd
, including simulating its
quirks, and leaving the original parent slice in place.message
- operation detailsresults
- operation results.Exception
public void simDeleteShard(ZkNodeProps message, NamedList results) throws Exception
DeleteShardCmd
message
- operation detailsresults
- operation resultsException
public void createSystemCollection() throws IOException
IOException
public UpdateResponse simUpdate(UpdateRequest req) throws SolrException, InterruptedException, IOException
SEARCHER.searcher.numDocs
- increased by added docs, decreased by deleteById and deleteByQuerySEARCHER.searcher.deletedDocs
- decreased by deleteById and deleteByQuery by up to numDocs
SEARCHER.searcher.maxDoc
- always increased by the number of added docs.IMPORTANT limitations:
*:*
req
- update request. This request MUST have the collection
param set.UpdateResponse
SolrException
- on errors, such as nonexistent collection or unsupported deleteByQueryInterruptedException
IOException
public QueryResponse simQuery(QueryRequest req) throws SolrException, InterruptedException, IOException
public void simSetClusterProperties(Map<String,Object> properties) throws Exception
DistribStateManager
properties
- properties to setException
public void simSetClusterProperty(String key, Object value) throws Exception
DistribStateManager
key
- property namevalue
- property valueException
public void simSetCollectionProperties(String coll, Map<String,Object> properties) throws Exception
coll
- collection nameproperties
- propertiesException
public void simSetCollectionProperty(String coll, String key, String value) throws Exception
coll
- collection namekey
- property namevalue
- property valueException
public void simSetSliceProperties(String coll, String slice, Map<String,Object> properties) throws Exception
coll
- collection nameslice
- slice nameproperties
- slice propertiesException
public void simSetCollectionValue(String collection, String key, Object value) throws Exception
collection
- collection namekey
- property namevalue
- property valueException
public void simSetCollectionValue(String collection, String key, Object value, boolean delta, boolean divide) throws Exception
public void simSetShardValue(String collection, String shard, String key, Object value) throws Exception
collection
- collection nameshard
- shard name. If null then all shards will be affected.key
- property namevalue
- property valueException
public void simSetShardValue(String collection, String shard, String key, Object value, boolean delta, boolean divide) throws Exception
collection
- collection nameshard
- shard name. If null then all shards will be affected.key
- property namevalue
- property valuedelta
- if true then treat the numeric value as delta to add to the existing value
(or set the value to delta if missing)divide
- if the value is a Number
and this is true, then the value will be evenly
divided by the number of replicas.Exception
public void simSetReplicaValues(String node, Map<String,Map<String,List<ReplicaInfo>>> source, boolean overwrite)
public List<ReplicaInfo> simGetReplicaInfos(String node)
node
- node idpublic List<ReplicaInfo> simGetReplicaInfos(String collection, String shard)
public ReplicaInfo simGetReplicaInfo(String collection, String coreNode)
public List<String> simListCollections() throws InterruptedException
InterruptedException
public Map<String,Map<String,Object>> simGetCollectionStats() throws IOException, InterruptedException
IOException
InterruptedException
public ClusterState.CollectionRef getState(String collection)
getState
in interface ClusterStateProvider
public Set<String> getLiveNodes()
getLiveNodes
in interface ClusterStateProvider
public List<String> resolveAlias(String alias)
resolveAlias
in interface ClusterStateProvider
public Map<String,String> getAliasProperties(String alias)
getAliasProperties
in interface ClusterStateProvider
public ClusterState getClusterState() throws IOException
getClusterState
in interface ClusterStateProvider
IOException
public Map<String,Object> getClusterProperties()
getClusterProperties
in interface ClusterStateProvider
public String getPolicyNameByCollection(String coll)
getPolicyNameByCollection
in interface ClusterStateProvider
public void connect()
connect
in interface ClusterStateProvider
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isClosed()
isClosed
in interface SolrCloseable
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.