Class TimeRoutedAlias
- java.lang.Object
-
- org.apache.solr.cloud.api.collections.RoutedAlias
-
- org.apache.solr.cloud.api.collections.TimeRoutedAlias
-
public class TimeRoutedAlias extends RoutedAlias
Holds configuration for a routed alias, and some common code and constants.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.cloud.api.collections.RoutedAlias
RoutedAlias.Action
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>OPTIONAL_ROUTER_PARAMSOptional parameters for creating a routed alias excluding parameters for collection creation.static Set<String>REQUIRED_ROUTER_PARAMSParameters required for creating a routed aliasstatic StringROUTER_AUTO_DELETE_AGEstatic StringROUTER_INTERVALstatic StringROUTER_MAX_FUTUREstatic StringROUTER_PREEMPTIVE_CREATE_MATHstatic StringROUTER_STARTstatic org.apache.solr.client.solrj.RoutedAliasTypesTYPE-
Fields inherited from class org.apache.solr.cloud.api.collections.RoutedAlias
CREATE_COLLECTION_PREFIX, MINIMAL_REQUIRED_PARAMS, ROUTED_ALIAS_NAME_CORE_PROP, ROUTER_FIELD, ROUTER_TYPE_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<RoutedAlias.Action>calculateActions(String targetCol)Determine the combination of adds/deletes implied by the arrival of a document destined for the specified collection.StringcomputeInitialCollectionName()org.apache.solr.cloud.api.collections.RoutedAlias.CandidateCollectionfindCandidateGivenValue(AddUpdateCommand cmd)Given the route key, finds the correct collection and an indication of any collection that needs to be created.static StringformatCollectionNameFromInstant(String aliasName, Instant timestamp)Map<String,String>getAliasMetadata()StringgetAliasName()The name of the alias.StringgetAutoDeleteAgeMath()protected StringgetHeadCollectionIfOrdered(AddUpdateCommand cmd)Calculate the head collection (i.e.StringgetIntervalMath()longgetMaxFutureMs()Set<String>getOptionalParams()StringgetPreemptiveCreateWindow()Set<String>getRequiredParams()org.apache.solr.client.solrj.RoutedAliasTypesgetRoutedAliasType()StringgetRouteField()TimeZonegetTimeZone()static InstantparseInstantFromCollectionName(String aliasName, String collection)StringtoString()booleanupdateParsedCollectionAliases(org.apache.solr.common.cloud.ZkStateReader zkStateReader, boolean contextualize)Ensure our parsed version of the alias collection list is up to date.voidvalidateRouteValue(AddUpdateCommand cmd)Check that the value we will be routing on is legal for this type of routed alias.-
Methods inherited from class org.apache.solr.cloud.api.collections.RoutedAlias
createCollectionsIfRequired, fromProps, newAliasMustExistException
-
-
-
-
Field Detail
-
TYPE
public static final org.apache.solr.client.solrj.RoutedAliasTypes TYPE
-
ROUTER_START
public static final String ROUTER_START
- See Also:
- Constant Field Values
-
ROUTER_INTERVAL
public static final String ROUTER_INTERVAL
- See Also:
- Constant Field Values
-
ROUTER_MAX_FUTURE
public static final String ROUTER_MAX_FUTURE
- See Also:
- Constant Field Values
-
ROUTER_AUTO_DELETE_AGE
public static final String ROUTER_AUTO_DELETE_AGE
- See Also:
- Constant Field Values
-
ROUTER_PREEMPTIVE_CREATE_MATH
public static final String ROUTER_PREEMPTIVE_CREATE_MATH
- See Also:
- Constant Field Values
-
REQUIRED_ROUTER_PARAMS
public static final Set<String> REQUIRED_ROUTER_PARAMS
Parameters required for creating a routed alias
-
-
Method Detail
-
computeInitialCollectionName
public String computeInitialCollectionName()
-
parseInstantFromCollectionName
public static Instant parseInstantFromCollectionName(String aliasName, String collection)
-
formatCollectionNameFromInstant
public static String formatCollectionNameFromInstant(String aliasName, Instant timestamp)
-
updateParsedCollectionAliases
public boolean updateParsedCollectionAliases(org.apache.solr.common.cloud.ZkStateReader zkStateReader, boolean contextualize)Description copied from class:RoutedAliasEnsure our parsed version of the alias collection list is up to date. If it was modified, return true. Note that this will return true if some other alias was modified or if properties were modified. These are spurious and the caller should be written to be tolerant of no material changes.- Specified by:
updateParsedCollectionAliasesin classRoutedAlias
-
getAliasName
public String getAliasName()
Description copied from class:RoutedAliasThe name of the alias. This name is used in place of a collection name for both queries and updates.- Specified by:
getAliasNamein classRoutedAlias- Returns:
- The name of the Alias.
-
getRouteField
public String getRouteField()
-
getRoutedAliasType
public org.apache.solr.client.solrj.RoutedAliasTypes getRoutedAliasType()
-
getIntervalMath
public String getIntervalMath()
-
getMaxFutureMs
public long getMaxFutureMs()
-
getPreemptiveCreateWindow
public String getPreemptiveCreateWindow()
-
getAutoDeleteAgeMath
public String getAutoDeleteAgeMath()
-
getTimeZone
public TimeZone getTimeZone()
-
validateRouteValue
public void validateRouteValue(AddUpdateCommand cmd) throws org.apache.solr.common.SolrException
Description copied from class:RoutedAliasCheck that the value we will be routing on is legal for this type of routed alias.- Specified by:
validateRouteValuein classRoutedAlias- Parameters:
cmd- the command containing the document- Throws:
org.apache.solr.common.SolrException
-
getRequiredParams
public Set<String> getRequiredParams()
- Specified by:
getRequiredParamsin classRoutedAlias
-
getOptionalParams
public Set<String> getOptionalParams()
- Specified by:
getOptionalParamsin classRoutedAlias
-
getHeadCollectionIfOrdered
protected String getHeadCollectionIfOrdered(AddUpdateCommand cmd)
Description copied from class:RoutedAliasCalculate the head collection (i.e. the most recent one for a TRA) if this routed alias has an implicit order, or if the collection is unordered return the appropriate collection name for the value in the current document. This method should never return null.- Specified by:
getHeadCollectionIfOrderedin classRoutedAlias
-
findCandidateGivenValue
public org.apache.solr.cloud.api.collections.RoutedAlias.CandidateCollection findCandidateGivenValue(AddUpdateCommand cmd)
Given the route key, finds the correct collection and an indication of any collection that needs to be created. Future docs will potentially cause creation of a collection that does not yet exist. This method presumes that the doc time stamp has already been checked to not exceed maxFutureMs- Throws:
org.apache.solr.common.SolrException- if the doc is too old to be stored in the TRA
-
calculateActions
protected List<RoutedAlias.Action> calculateActions(String targetCol)
Description copied from class:RoutedAliasDetermine the combination of adds/deletes implied by the arrival of a document destined for the specified collection.- Specified by:
calculateActionsin classRoutedAlias- Parameters:
targetCol- the collection for which a document is destined.- Returns:
- A list of actions across the DRA.
-
-