[ 
https://issues.apache.org/jira/browse/SOLR-13148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16753621#comment-16753621
 ] 

mosh commented on SOLR-13148:
-----------------------------

Patch seems well thought out.

Once place where TimeRoutedAlias is still hard coded, is CreateAliasCmd.
 The main offender seems to be CreateAliasCmd#callCreateRoutedAlias:

 
{code:java}
private void callCreateRoutedAlias(ZkNodeProps message, String aliasName, 
ZkStateReader zkStateReader, ClusterState state) throws Exception {
    // Validate we got everything we need
    if 
(!message.getProperties().keySet().containsAll(TimeRoutedAlias.REQUIRED_ROUTER_PARAMS))
 {
      throw new SolrException(BAD_REQUEST, "A routed alias requires these 
params: " + TimeRoutedAlias.REQUIRED_ROUTER_PARAMS
      + " plus some create-collection prefixed ones.");
    }

    Map<String, String> aliasProperties = new LinkedHashMap<>();
    message.getProperties().entrySet().stream()
        .filter(entry -> TimeRoutedAlias.PARAM_IS_PROP.test(entry.getKey()))
        .forEach(entry -> aliasProperties.put(entry.getKey(), (String) 
entry.getValue())); // way easier than .collect

    TimeRoutedAlias timeRoutedAlias = new TimeRoutedAlias(aliasName, 
aliasProperties); // validates as well

    String start = message.getStr(TimeRoutedAlias.ROUTER_START);
    Instant startTime = parseStart(start, timeRoutedAlias.getTimeZone());

    String initialCollectionName = 
TimeRoutedAlias.formatCollectionNameFromInstant(aliasName, startTime);

    // Create the collection
    createCollectionAndWait(state, aliasName, aliasProperties, 
initialCollectionName, ocmh);
    
validateAllCollectionsExistAndNoDups(Collections.singletonList(initialCollectionName),
 zkStateReader);

    // Create/update the alias
    zkStateReader.aliasesManager.applyModificationAndExportToZk(aliases -> 
aliases
        .cloneWithCollectionAlias(aliasName, initialCollectionName)
        .cloneWithCollectionAliasProperties(aliasName, aliasProperties));
  }
{code}
Have you got anything in mind, when it comes to keeping router types and 
required params?
 I was thinking about using a factory which shall reside in RoutedAlias, where 
aliases are mapped to their corresponding router.name("time", "category", etc).
 [~gus_heck],
 WDYT

> Move time based logic into TimeRoutedAlias class
> ------------------------------------------------
>
>                 Key: SOLR-13148
>                 URL: https://issues.apache.org/jira/browse/SOLR-13148
>             Project: Solr
>          Issue Type: Sub-task
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: UpdateRequestProcessors
>    Affects Versions: master (9.0)
>            Reporter: Gus Heck
>            Assignee: Gus Heck
>            Priority: Major
>         Attachments: SOLR-13148.patch, SOLR-13148.patch
>
>
> To pave the way for new types of routed aliases we need to get any and all 
> time related logic out of the URP and into TimeRoutedAlias. This ticket will 
> do that, Rename the URP and extract an initial proposed Generic RoutedAlias 
> interface implemented by both TimeRoutedAlias and a skeleton place holder for 
> CategoryRoutedAlias



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to