Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12817

Simply response processing in CreateShardCmd

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      While working on SOLR-12708 , Mano disccovered used the response parsing technique from CreateShardCmd

      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"));
          }
        });
      }

       

      This code works as the response can have either a failure or a success. But isn't it the same as doing this?

      ocmh.addReplica(zkStateReader.getClusterState(), addReplicasProps, results, null);

       

      Maybe I am missing the motication here . Cao Manh Dat WDYT? If the usage is needed then at-least I'd want to document the reason in the code for future refernece.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                varun Varun Thacker
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: