diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 0a54b4d103d..979c1fd0f92 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -369,6 +369,9 @@ Other Changes References to zkCredentialProvider in System properties or configurations should be changed to zkCredentialsProvider. (Gregory Chanan) +* SOLR-6715: ZkSolrResourceLoader constructors accept a parameter called 'collection' + but it should be 'configName'. (shalin) + ================== 4.10.3 ================== Bug Fixes diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java index 122e4c39461..14c7f96f3ae 100644 --- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java +++ b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java @@ -88,7 +88,7 @@ public class CloudUtil { /** * Returns a displayable unified path to the given resource. For non-solrCloud that will be the - * same as getConfigDir, but for Cloud it will be getCollectionZkPath ending in a / + * same as getConfigDir, but for Cloud it will be getConfigSetZkPath ending in a / *

* Note: Do not use this to generate a valid file path, but for debug printing etc * @param loader Resource loader instance @@ -96,7 +96,7 @@ public class CloudUtil { */ public static String unifiedResourcePath(SolrResourceLoader loader) { return (loader instanceof ZkSolrResourceLoader) ? - ((ZkSolrResourceLoader) loader).getCollectionZkPath() + "/" : + ((ZkSolrResourceLoader) loader).getConfigSetZkPath() + "/" : loader.getConfigDir(); } } diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java index 5278afd67e5..55d2ae0bfca 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java @@ -1200,7 +1200,7 @@ public final class ZkController { boolean removeWatch = true; // if there is no SolrCore which is a member of this collection, remove the watch for (SolrCore solrCore : cc.getCores()) { - if (((ZkSolrResourceLoader)solrCore.getResourceLoader()).getCollectionZkPath().equals(configLocation)) + if (((ZkSolrResourceLoader)solrCore.getResourceLoader()).getConfigSetZkPath().equals(configLocation)) configLocation = null; //if a core uses this config dir , then set it to null @@ -2119,7 +2119,7 @@ public final class ZkController { final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader; final ZkController zkController = zkLoader.getZkController(); final SolrZkClient zkClient = zkController.getZkClient(); - final String resourceLocation = zkLoader.getCollectionZkPath() + "/" + resourceName; + final String resourceLocation = zkLoader.getConfigSetZkPath() + "/" + resourceName; String errMsg = "Failed to persist resource at {0} - version mismatch"; try { try { diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java index 29efdd68a64..5334e853d20 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java @@ -38,16 +38,16 @@ import org.apache.zookeeper.data.Stat; */ public class ZkSolrResourceLoader extends SolrResourceLoader { - private final String collectionZkPath; + private final String configSetZkPath; private ZkController zkController; private ZkIndexSchemaReader zkIndexSchemaReader; - public ZkSolrResourceLoader(String instanceDir, String collection, + public ZkSolrResourceLoader(String instanceDir, String configSet, ZkController zooKeeperController) { super(instanceDir); this.zkController = zooKeeperController; - collectionZkPath = ZkController.CONFIGS_ZKNODE + "/" + collection; - zkController.watchZKConfDir(collectionZkPath); + configSetZkPath = ZkController.CONFIGS_ZKNODE + "/" + configSet; + zkController.watchZKConfDir(configSetZkPath); } /** @@ -58,12 +58,12 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { * the "lib/" directory in the specified instance directory. *

*/ - public ZkSolrResourceLoader(String instanceDir, String collection, ClassLoader parent, + public ZkSolrResourceLoader(String instanceDir, String configSet, ClassLoader parent, Properties coreProperties, ZkController zooKeeperController) { super(instanceDir, parent, coreProperties); this.zkController = zooKeeperController; - collectionZkPath = ZkController.CONFIGS_ZKNODE + "/" + collection; - zkController.watchZKConfDir(collectionZkPath); + configSetZkPath = ZkController.CONFIGS_ZKNODE + "/" + configSet; + zkController.watchZKConfDir(configSetZkPath); } /** @@ -78,7 +78,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { @Override public InputStream openResource(String resource) throws IOException { InputStream is = null; - String file = collectionZkPath + "/" + resource; + String file = configSetZkPath + "/" + resource; try { if (zkController.pathExists(file)) { Stat stat = new Stat(); @@ -96,7 +96,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { } if (is == null) { throw new IOException("Can't find resource '" + resource - + "' in classpath or '" + collectionZkPath + "', cwd=" + + "' in classpath or '" + configSetZkPath + "', cwd=" + System.getProperty("user.dir")); } return is; @@ -131,7 +131,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { public String[] listConfigDir() { List list; try { - list = zkController.getZkClient().getChildren(collectionZkPath, null, true); + list = zkController.getZkClient().getChildren(configSetZkPath, null, true); } catch (InterruptedException e) { // Restore the interrupted status Thread.currentThread().interrupt(); @@ -146,8 +146,8 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { return list.toArray(new String[0]); } - public String getCollectionZkPath() { - return collectionZkPath; + public String getConfigSetZkPath() { + return configSetZkPath; } public ZkController getZkController() { diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java index 65e6f0ae00c..4a554049419 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -684,7 +684,7 @@ public class CoreContainer { // cancel recovery in cloud mode core.getSolrCoreState().cancelRecovery(); } - String collectionZkPath = core.getResourceLoader() instanceof ZkSolrResourceLoader ? ((ZkSolrResourceLoader)core.getResourceLoader()).getCollectionZkPath() : null; + String configSetZkPath = core.getResourceLoader() instanceof ZkSolrResourceLoader ? ((ZkSolrResourceLoader)core.getResourceLoader()).getConfigSetZkPath() : null; core.unloadOnClose(deleteIndexDir, deleteDataDir, deleteInstanceDir); if (close) @@ -692,7 +692,7 @@ public class CoreContainer { if (zkSys.getZkController() != null) { try { - zkSys.getZkController().unregister(name, cd, collectionZkPath); + zkSys.getZkController().unregister(name, cd, configSetZkPath); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SolrException(ErrorCode.SERVER_ERROR, "Interrupted while unregistering core [" + name + "] from cloud state"); diff --git a/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java b/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java index b7e5ddfee8d..c89097de591 100644 --- a/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java @@ -100,7 +100,7 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa public void run() { try { if(core.isClosed()) return; - Stat stat = zkSolrResourceLoader.getZkController().getZkClient().exists((zkSolrResourceLoader).getCollectionZkPath() + "/" + ConfigOverlay.RESOURCE_NAME, null, true); + Stat stat = zkSolrResourceLoader.getZkController().getZkClient().exists((zkSolrResourceLoader).getConfigSetZkPath() + "/" + ConfigOverlay.RESOURCE_NAME, null, true); if(stat == null) return; if (stat.getVersion() > core.getSolrConfig().getOverlay().getZnodeVersion()) { core.getCoreDescriptor().getCoreContainer().reload(core.getName()); @@ -115,7 +115,7 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa } }; - zkSolrResourceLoader.getZkController().registerConfListenerForCore(zkSolrResourceLoader.getCollectionZkPath(), core,listener); + zkSolrResourceLoader.getZkController().registerConfListenerForCore(zkSolrResourceLoader.getConfigSetZkPath(), core,listener); } } diff --git a/solr/core/src/java/org/apache/solr/handler/admin/EditFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/EditFileRequestHandler.java index 21b04cea9da..3560176a5f1 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/EditFileRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/EditFileRequestHandler.java @@ -282,7 +282,7 @@ public class EditFileRequestHandler extends RequestHandlerBase { if (coreContainer.isZooKeeperAware()) { try { - String confPath = ((ZkSolrResourceLoader) core.getResourceLoader()).getCollectionZkPath(); + String confPath = ((ZkSolrResourceLoader) core.getResourceLoader()).getConfigSetZkPath(); ZkController.downloadConfigDir(coreContainer.getZkController().getZkClient(), confPath, new File(coll, "conf")); diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java index 0dccdf9adb2..d9a8077df9c 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java @@ -304,7 +304,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase final ZkSolrResourceLoader loader = (ZkSolrResourceLoader) core .getResourceLoader(); - String confPath = loader.getCollectionZkPath(); + String confPath = loader.getConfigSetZkPath(); String fname = req.getParams().get("file", null); if (fname == null) { diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java index 014dc7bea3f..2e20729642c 100644 --- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java +++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java @@ -165,7 +165,7 @@ public final class ManagedIndexSchema extends IndexSchema { final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader; final ZkController zkController = zkLoader.getZkController(); final SolrZkClient zkClient = zkController.getZkClient(); - final String managedSchemaPath = zkLoader.getCollectionZkPath() + "/" + managedSchemaResourceName; + final String managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + managedSchemaResourceName; boolean success = true; boolean schemaChangedInZk = false; try { diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java index 76466677220..ad53b7b84ae 100644 --- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java +++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java @@ -119,7 +119,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol } else { // ZooKeeper final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader; final SolrZkClient zkClient = zkLoader.getZkController().getZkClient(); - final String managedSchemaPath = zkLoader.getCollectionZkPath() + "/" + managedSchemaResourceName; + final String managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + managedSchemaResourceName; Stat stat = new Stat(); try { // Attempt to load the managed schema @@ -224,7 +224,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol SolrResourceLoader loader = config.getResourceLoader(); if (loader instanceof ZkSolrResourceLoader) { ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader; - String nonManagedSchemaPath = zkLoader.getCollectionZkPath() + "/" + resourceName; + String nonManagedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + resourceName; try { exists = zkLoader.getZkController().pathExists(nonManagedSchemaPath); } catch (InterruptedException e) { @@ -349,7 +349,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol } else { // Rename the non-managed schema znode in ZooKeeper ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader; - final String nonManagedSchemaPath = zkLoader.getCollectionZkPath() + "/" + resourceName; + final String nonManagedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + resourceName; try { ZkController zkController = zkLoader.getZkController(); ZkCmdExecutor zkCmdExecutor = new ZkCmdExecutor(zkController.getClientTimeout()); diff --git a/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java b/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java index 5758d0452e5..1e88a448b7a 100644 --- a/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java +++ b/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java @@ -43,7 +43,7 @@ public class ZkIndexSchemaReader implements OnReconnect { this.managedIndexSchemaFactory = managedIndexSchemaFactory; ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)managedIndexSchemaFactory.getResourceLoader(); this.zkClient = zkLoader.getZkController().getZkClient(); - managedSchemaPath = zkLoader.getCollectionZkPath() + "/" + managedIndexSchemaFactory.getManagedSchemaResourceName(); + managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + managedIndexSchemaFactory.getManagedSchemaResourceName(); createSchemaWatcher(); zkLoader.getZkController().addOnReconnectListener(this); }