forked from apache/solr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In-memory synthetic
SolrCore
for QA node (#181)
* Experimental QA core as proxy in memory * Experimental QA core as proxy in memory * Experimental QA core as proxy in memory * ./gradlew tidy * Comment out portion that checks for synthetic collection/core existence * Fixes watches and test cases * Refactoring to avoid modifying existing method modifiers * Cleanup * Some refactoring to minimize changes to SolrCore * javadoc * ./gradlew tidy * code cleanup * code cleanup * Fix resource loader issue if configSetName is null * ./gradlew tidy * Fixed issue with incorrect collection name in context Ensure only one synthetic core created per config set * ./gradlew tidy * Correctly use <config set>_core as synthetic core name for clarity Should open the registered core on first synthetic core creation since it is a getCore op * ./gradlew tidy * Fixed issue with incorrect collection name in context
- Loading branch information
Showing
6 changed files
with
168 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.apache.solr.core; | ||
|
||
import java.nio.file.Paths; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.apache.solr.common.SolrException; | ||
import org.apache.solr.common.params.CoreAdminParams; | ||
import org.apache.solr.rest.RestManager; | ||
|
||
/** | ||
* A synthetic core that is created only in memory and not registered against Zookeeper. | ||
* | ||
* <p>This is only used in Coordinator node to support a subset of SolrCore functionalities required | ||
* by Coordinator operations such as aggregating and writing out response and providing configset | ||
* info. | ||
* | ||
* <p>There should only be one instance of SyntheticSolrCore per configset | ||
*/ | ||
public class SyntheticSolrCore extends SolrCore { | ||
public SyntheticSolrCore(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { | ||
super(coreContainer, cd, configSet); | ||
} | ||
|
||
public static SyntheticSolrCore createAndRegisterCore( | ||
CoreContainer coreContainer, String syntheticCoreName, String configSetName) { | ||
Map<String, String> coreProps = new HashMap<>(); | ||
coreProps.put(CoreAdminParams.CORE_NODE_NAME, coreContainer.getHostName()); | ||
coreProps.put(CoreAdminParams.COLLECTION, syntheticCoreName); | ||
|
||
CoreDescriptor syntheticCoreDescriptor = | ||
new CoreDescriptor( | ||
syntheticCoreName, | ||
Paths.get(coreContainer.getSolrHome() + "/" + syntheticCoreName), | ||
coreProps, | ||
coreContainer.getContainerProperties(), | ||
coreContainer.getZkController()); | ||
|
||
ConfigSet coreConfig = | ||
coreContainer.getConfigSetService().loadConfigSet(syntheticCoreDescriptor, configSetName); | ||
syntheticCoreDescriptor.setConfigSetTrusted(coreConfig.isTrusted()); | ||
SyntheticSolrCore syntheticCore = | ||
new SyntheticSolrCore(coreContainer, syntheticCoreDescriptor, coreConfig); | ||
coreContainer.registerCore(syntheticCoreDescriptor, syntheticCore, false, false); | ||
|
||
return syntheticCore; | ||
} | ||
|
||
@Override | ||
protected void bufferUpdatesIfConstructing(CoreDescriptor coreDescriptor) { | ||
// no updates to SyntheticSolrCore | ||
} | ||
|
||
@Override | ||
protected RestManager initRestManager() throws SolrException { | ||
// returns an initialized RestManager. As init routines requires reading configname of the | ||
// core's collection from ZK | ||
// which synthetic core is not registered in ZK. | ||
// We do not expect RestManager ops on Coordinator Nodes | ||
return new RestManager(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
super.close(); | ||
} | ||
} |
Oops, something went wrong.