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

Collection ZK nodes do not reflect the correct router chosen


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.4, 4.5, 6.0
    • Fix Version/s: 4.6, 6.0
    • Component/s: SolrCloud


      In ZkController.createCollectionZkNode, the doc router is determined by this code snippet:

      if (collectionProps.get(DocCollection.DOC_ROUTER) == null) {
      Object numShards = collectionProps.get(ZkStateReader.NUM_SHARDS_PROP);
      if (numShards == null)

      { numShards = System.getProperty(ZkStateReader.NUM_SHARDS_PROP); }

      if (numShards == null)

      { collectionProps.put(DocCollection.DOC_ROUTER, ImplicitDocRouter.NAME); }


      { collectionProps.put(DocCollection.DOC_ROUTER, DocRouter.DEFAULT_NAME); }


      Since OverseerCollectionProcessor never passes on any params prefixed with "collection" other than "collection.configName" in its create core commands, collectionProps.get(DocCollection.DOC_ROUTER) will never be non-null. Thus, it needs to figure out if the router is implicit or compositeID based on if numShards is passed in. However, collectionProps.get(ZkStateReader.NUM_SHARDS_PROP) will also always be null for the same reason collectionProps.get(DocCollection.DOC_ROUTER) is null, and it isn't explicitly set in the code above, so the only way for numShards not to be null is if it's passed in as a system property.

      As an example, here's a cluster state that's created as compositeId router, but the collection ZK node says it's implicit:

      in clusterstate.json:


      in /collections/example data:

      { "configName":"myconf", "router":"implicit"}

      I've not sure if the collection ZK node router info is actually used anywhere, so it may not matter, but it's confusing.

      I think the best fix is for OverseerCollectionProcessor to pass on params prefixed with "collection." to the core creation requests. Otherwise, ZkController.createCollectionZkNode can explicitly set the numShards collectionProps by cd.getNumShards() too.




            • Assignee:
              shalinmangar Shalin Shekhar Mangar
              mewmewball Jessica Cheng Mallet
            • Votes:
              0 Vote for this issue
              5 Start watching this issue


              • Created: