You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Varun Thacker (JIRA)" <ji...@apache.org> on 2018/10/01 20:06:00 UTC

[jira] [Commented] (SOLR-12817) Simply response processing in CreateShardCmd

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

Varun Thacker commented on SOLR-12817:
--------------------------------------

Hi [~ab] , [~noble.paul] any insights here?

> Simply response processing in CreateShardCmd
> --------------------------------------------
>
>                 Key: SOLR-12817
>                 URL: https://issues.apache.org/jira/browse/SOLR-12817
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Varun Thacker
>            Priority: Major
>
> While working on SOLR-12708 , Mano disccovered used the response parsing technique from CreateShardCmd
> {code:java}
> final NamedList addResult = new NamedList();
> try {
>   ocmh.addReplica(zkStateReader.getClusterState(), addReplicasProps, addResult, () -> {
>     Object addResultFailure = addResult.get("failure");
>     if (addResultFailure != null) {
>       SimpleOrderedMap failure = (SimpleOrderedMap) results.get("failure");
>       if (failure == null) {
>         failure = new SimpleOrderedMap();
>         results.add("failure", failure);
>       }
>       failure.addAll((NamedList) addResultFailure);
>     } else {
>       SimpleOrderedMap success = (SimpleOrderedMap) results.get("success");
>       if (success == null) {
>         success = new SimpleOrderedMap();
>         results.add("success", success);
>       }
>       success.addAll((NamedList) addResult.get("success"));
>     }
>   });
> }{code}
>  
> This code works as the response can have either a failure or a success. But isn't it the same as doing this? 
> {code:java}
> ocmh.addReplica(zkStateReader.getClusterState(), addReplicasProps, results, null);{code}
>  
> Maybe I am missing the motication here . [~caomanhdat] WDYT? If the usage is needed then at-least I'd want to document the reason in the code for future refernece.



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

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