mirror of https://github.com/apache/lucene.git
SOLR-13739: Optimized large managed schema modifications
Internal O(n^2) problem. Fixes #855
This commit is contained in:
parent
46a03fff95
commit
e788024b84
|
@ -157,6 +157,8 @@ Improvements
|
||||||
|
|
||||||
* SOLR-13742: Allow optional redaction of data saved by 'bin/solr autoscaling -save'. (ab)
|
* SOLR-13742: Allow optional redaction of data saved by 'bin/solr autoscaling -save'. (ab)
|
||||||
|
|
||||||
|
* SOLR-13739: Optimized large managed schema modifications; Internal O(n^2) problem. (Thomas Wöckinger via David Smiley)
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.solr.rest;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -79,7 +80,7 @@ public abstract class ManagedResource {
|
||||||
* Called once during core initialization to get the managed
|
* Called once during core initialization to get the managed
|
||||||
* data loaded from storage and notify observers.
|
* data loaded from storage and notify observers.
|
||||||
*/
|
*/
|
||||||
public void loadManagedDataAndNotify(List<ManagedResourceObserver> observers)
|
public void loadManagedDataAndNotify(Collection<ManagedResourceObserver> observers)
|
||||||
throws SolrException {
|
throws SolrException {
|
||||||
|
|
||||||
// load managed data from storage
|
// load managed data from storage
|
||||||
|
@ -101,8 +102,7 @@ public abstract class ManagedResource {
|
||||||
* reload the core to get updates applied to the analysis components that
|
* reload the core to get updates applied to the analysis components that
|
||||||
* depend on the ManagedResource data.
|
* depend on the ManagedResource data.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
protected void notifyObserversDuringInit(NamedList<?> args, Collection<ManagedResourceObserver> observers)
|
||||||
protected void notifyObserversDuringInit(NamedList<?> args, List<ManagedResourceObserver> observers)
|
|
||||||
throws SolrException {
|
throws SolrException {
|
||||||
|
|
||||||
if (observers == null || observers.isEmpty())
|
if (observers == null || observers.isEmpty())
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -76,7 +77,7 @@ public class RestManager {
|
||||||
private static class ManagedResourceRegistration {
|
private static class ManagedResourceRegistration {
|
||||||
String resourceId;
|
String resourceId;
|
||||||
Class<? extends ManagedResource> implClass;
|
Class<? extends ManagedResource> implClass;
|
||||||
List<ManagedResourceObserver> observers = new ArrayList<>();
|
Set<ManagedResourceObserver> observers = new LinkedHashSet<>();
|
||||||
|
|
||||||
private ManagedResourceRegistration(String resourceId,
|
private ManagedResourceRegistration(String resourceId,
|
||||||
Class<? extends ManagedResource> implClass,
|
Class<? extends ManagedResource> implClass,
|
||||||
|
@ -229,7 +230,7 @@ public class RestManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// there may be a RestManager, in which case, we want to add this new ManagedResource immediately
|
// there may be a RestManager, in which case, we want to add this new ManagedResource immediately
|
||||||
if (initializedRestManager != null) {
|
if (initializedRestManager != null && initializedRestManager.getManagedResourceOrNull(resourceId) == null) {
|
||||||
initializedRestManager.addRegisteredResource(registered.get(resourceId));
|
initializedRestManager.addRegisteredResource(registered.get(resourceId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue