epugh commented on a change in pull request #264:
URL: https://github.com/apache/solr/pull/264#discussion_r693484821



##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -91,6 +92,33 @@ public void init(NamedList<?> args) {
   public String getSchemaResourceName(String cdResourceName) {
     return managedSchemaResourceName; // actually a guess; reality depends on 
the actual files in the config set :-(
   }
+  
+  /**
+   * Lookup the path to the managed schema, dealing with falling back to the
+   * legacy managed-schema file, instead of the expected managed-schema.xml 
file.
+   * 
+   * This method is duplicated in ManagedIndexSchema.
+   * @see org.apache.solr.schema.ManagedIndexSchema#lookupManagedSchemaPath
+   */
+  public String lookupManagedSchemaPath() {
+    final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader;
+    final ZkController zkController = zkLoader.getZkController();
+    final SolrZkClient zkClient = zkController.getZkClient();
+    String managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + 
managedSchemaResourceName;
+    try {
+      // check if we are using the legacy managed-schema file name.
+      if (!zkClient.exists(managedSchemaPath, true)){
+        log.info("Managed schema resource {} not found - loading legacy 
managed schema {} file instead"
+            , managedSchemaResourceName, 
ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME);
+        managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + 
ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME;
+      }
+    } catch (KeeperException e) {
+      throw new RuntimeException(e);
+    } catch (InterruptedException e) {
+      throw new RuntimeException(e);

Review comment:
       Done....    I don't know how you knew to set that however!   Wonder if 
there is a check that could have flagged this?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to