SOLR-14750: use core id to avoid duplicate core reloads

This commit is contained in:
noblepaul 2020-08-22 17:53:55 +10:00
parent c9c75810c2
commit 1c8f4c988a
3 changed files with 5 additions and 4 deletions

View File

@ -3060,6 +3060,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
public static Runnable getConfListener(SolrCore core, ZkSolrResourceLoader zkSolrResourceLoader) {
final String coreName = core.getName();
final UUID coreId = core.uniqueId;
final CoreContainer cc = core.getCoreContainer();
final String overlayPath = zkSolrResourceLoader.getConfigSetZkPath() + "/" + ConfigOverlay.RESOURCE_NAME;
final String solrConfigPath = zkSolrResourceLoader.getConfigSetZkPath() + "/" + core.getSolrConfig().getName();
@ -3095,7 +3096,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
if (configHandler.getReloadLock().tryLock()) {
try {
cc.reload(coreName);
cc.reload(coreName, coreId);
} catch (SolrCoreState.CoreIsClosedException e) {
/*no problem this core is already closed*/
} finally {

View File

@ -547,7 +547,7 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa
latestVersion, 30);
} else {
SolrResourceLoader.persistConfLocally(loader, ConfigOverlay.RESOURCE_NAME, overlay.toByteArray());
req.getCore().getCoreContainer().reload(req.getCore().getName());
req.getCore().getCoreContainer().reload(req.getCore().getName(), req.getCore().uniqueId);
log.info("Executed config commands successfully and persisted to File System {}", ops);
}

View File

@ -132,7 +132,7 @@ public class SchemaManager {
latestVersion = ZkController.persistConfigResourceToZooKeeper
(zkLoader, managedIndexSchema.getSchemaZkVersion(), managedIndexSchema.getResourceName(),
sw.toString().getBytes(StandardCharsets.UTF_8), true);
req.getCore().getCoreContainer().reload(req.getCore().getName());
req.getCore().getCoreContainer().reload(req.getCore().getName(), req.getCore().uniqueId);
break;
} catch (ZkController.ResourceModifiedInZkException e) {
log.info("Schema was modified by another node. Retrying..");
@ -142,7 +142,7 @@ public class SchemaManager {
//only for non cloud stuff
managedIndexSchema.persistManagedSchema(false);
core.setLatestSchema(managedIndexSchema);
core.getCoreContainer().reload(core.getName());
core.getCoreContainer().reload(core.getName(), core.uniqueId);
} catch (SolrException e) {
log.warn(errorMsg);
errors = singletonList(errorMsg + e.getMessage());