mirror of https://github.com/apache/lucene.git
SOLR-6715: ZkSolrResourceLoader constructors accept a parameter called 'collection' but it should be 'configName'
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1637296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
497e64e2b9
commit
4905248879
|
@ -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
|
||||
|
|
|
@ -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 /
|
||||
* <p/>
|
||||
* <b>Note:</b> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
*/
|
||||
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<String> 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() {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue