Package org.apache.solr.common.cloud
Class DocCollection
java.lang.Object
org.apache.solr.common.cloud.ZkNodeProps
org.apache.solr.common.cloud.DocCollection
- All Implemented Interfaces:
Iterable<Slice>,MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceJSON properties related to a collection's state.static interfaceNested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
FieldsFields inherited from class org.apache.solr.common.cloud.ZkNodeProps
propMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyWithSlices(Map<String, Slice> slices) Use this to make an exact copy of DocCollection with a new set of Slices and every other property as isstatic DocCollectioncreate(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, Instant creationTime, DocCollection.PrsSupplier prsSupplier) Builds a DocCollection with an optional PrsSupplierbooleanvoidforEachReplica(BiConsumer<String, Replica> consumer) Return the list of active slices for this collection.Slice[]Deprecated.Get the map of active slices (sliceName->Slice) for this collection.intstatic StringgetCollectionPath(String coll) static StringgetCollectionPathRoot(String coll) Return non-null config nameThe creation time of the Collection.intgetExpectedReplicaCount(Replica.Type type, int def) Deprecated.getLeaderReplicas(String nodeName) Deprecated.getName()Return collection name.Deprecated.Deprecated.intgetNumReplicas(Replica.Type type) Deprecated.getReplica(String coreNodeName) getReplica(BiPredicate<String, Replica> predicate) Deprecated.Deprecated.getReplicas(String nodeName) Deprecated.Deprecated.getReplicasOnNode(String nodeName) Get the list of replicas hosted on the given node ornullif none.getShardId(String nodeName, String coreName) Deprecated.Gets the list of all slices for this collection.Get the map of all slices (sliceName->Slice) for this collection.getZNode()intinthashCode()static booleanisFullyActive(Set<String> liveNodes, DocCollection collectionState, int expectedShards, int expectedReplicas) Deprecated.booleanisModified(int dataVersion, int childVersion) booleanbooleaniterator()final DocCollectionsetPerReplicaStates(PerReplicaStates newPerReplicaStates) Update our state with a state of aPerReplicaStateswhich could override states ofReplica.toString()static ObjectverifyProp(Map<String, Object> props, String propName) voidMethods inherited from class org.apache.solr.common.cloud.ZkNodeProps
containsKey, fromKeyVals, get, getBool, getInt, getProperties, getStr, getStr, keySet, load, plus, plus, shallowCopyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _get, _getStr, _getStr, _getStr, _size
-
Field Details
-
COLLECTIONS_ZKNODE
- See Also:
-
-
Constructor Details
-
DocCollection
@Deprecated public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router) Deprecated.- See Also:
-
DocCollection
@Deprecated public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion) Deprecated.- See Also:
-
-
Method Details
-
create
public static DocCollection create(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, Instant creationTime, DocCollection.PrsSupplier prsSupplier) Builds a DocCollection with an optional PrsSupplier- Parameters:
name- The name of the collectionslices- The logical shards of the collection. This is used directly and a copy is not made.props- The properties of the slice. This is used directly and a copy is not made.router- router to partition int range into n rangeszkVersion- The version of the Collection node in Zookeeper (used for conditional updates).creationTime- The creation time of the collectionprsSupplier- optional supplier for PerReplicaStates (PRS) for PRS enabled collections- Returns:
- a newly constructed DocCollection
-
getCollectionPath
-
getCollectionPathRoot
-
setPerReplicaStates
Update our state with a state of aPerReplicaStateswhich could override states ofReplica.Take note that it updates the underlying AtomicReference such that all Slice and Replica that holds the same AtomicReference will see the same update
This does not create a new DocCollection.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
verifyProp
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
copyWithSlices
Use this to make an exact copy of DocCollection with a new set of Slices and every other property as is- Parameters:
slices- the new set of Slices- Returns:
- the resulting DocCollection
-
getName
Return collection name. -
getConfigName
Return non-null config name -
getSlice
-
forEachReplica
- Parameters:
consumer- consume shardName vs. replica
-
getSlices
Gets the list of all slices for this collection. -
getActiveSlices
Return the list of active slices for this collection. -
getActiveSlicesArr
Deprecated.Return array of active slices for this collection (performance optimization). -
getSlicesMap
Get the map of all slices (sliceName->Slice) for this collection. -
getActiveSlicesMap
Get the map of active slices (sliceName->Slice) for this collection. -
getReplicas
Deprecated.Get the list of replicas hosted on the given node ornullif none. -
getReplicasOnNode
Get the list of replicas hosted on the given node ornullif none. -
getLeaderReplicas
Deprecated.Get the list of all leaders hosted on the given node ornullif none. -
getZNodeVersion
public int getZNodeVersion() -
getChildNodesVersion
public int getChildNodesVersion() -
isModified
public boolean isModified(int dataVersion, int childVersion) -
getReplicationFactor
- Returns:
- replication factor for this collection or null if no replication factor exists.
-
getZNode
-
getRouter
-
isReadOnly
public boolean isReadOnly() -
getCreationTime
The creation time of the Collection. When this collection is read from ZooKeeper, this is the creation time of the collection node. -
toString
- Overrides:
toStringin classZkNodeProps
-
writeMap
- Specified by:
writeMapin interfaceMapWriter- Overrides:
writeMapin classZkNodeProps- Throws:
IOException
-
getReplica
-
getLeader
-
isFullyActive
@Deprecated public static boolean isFullyActive(Set<String> liveNodes, DocCollection collectionState, int expectedShards, int expectedReplicas) Deprecated.Check that all replicas in a collection are live- See Also:
-
iterator
-
getReplicas
Deprecated. -
getReplica
Deprecated.- Parameters:
predicate- test against shardName vs. replica- Returns:
- the first replica that matches the predicate
-
getReplicas
Deprecated. -
getShardId
Deprecated.Get the shardId of a core on a specific node -
equals
- Overrides:
equalsin classZkNodeProps
-
hashCode
public int hashCode()- Overrides:
hashCodein classZkNodeProps
-
getNumNrtReplicas
Deprecated.- Returns:
- the number of replicas of type
Replica.Type.NRTthis collection was created with
-
getNumTlogReplicas
Deprecated.- Returns:
- the number of replicas of type
Replica.Type.TLOGthis collection was created with
-
getNumPullReplicas
Deprecated.- Returns:
- the number of replicas of type
Replica.Type.PULLthis collection was created with
-
getNumReplicas
- Returns:
- the number of replicas of a given type this collection was created with
-
isPerReplicaState
public boolean isPerReplicaState() -
getPerReplicaStates
-
getExpectedReplicaCount
Deprecated.
-