You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/08/30 14:06:35 UTC

[GitHub] [lucene-solr] noblepaul opened a new pull request #1804: SOLR-14151: Bbug fixes

noblepaul opened a new pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul commented on a change in pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
noblepaul commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480663558



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       This happens only if you share the schema. If schema is not shared it only results in reloading schema in that one core. This needs to be a bit more tight. I'm still working on 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul commented on pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
noblepaul commented on pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#issuecomment-684522091


   please refer to #1815 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] tflobbe commented on a change in pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
tflobbe commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480308790



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       Each IndexSchema object gets a `PackageListeningClassLoader` with a listener that, on change, triggers a reload of the schema in all cores? 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] tflobbe commented on a change in pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
tflobbe commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480308790



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       Could you explain this a bit? Each IndexSchema object gets a `PackageListeningClassLoader` with a listener that, on change, triggers a reload of the schema in all cores? 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul closed pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
noblepaul closed pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul commented on a change in pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
noblepaul commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480663558



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       This happens only if you share the schema. If schema is not shared it only results in reloading schema in that one core




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul commented on a change in pull request #1804: SOLR-14151: Bug fixes

Posted by GitBox <gi...@apache.org>.
noblepaul commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480663558



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       This happens only if you share the schema. If schema is not shared it only results in reloading schema in that one core. This is a bit rusty. This needs to be a bit more tight




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org