forked from apache/solr
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAI-4837 : In-memory synthetic SolrCore
for QA node
#181
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7e2ffb6
Experimental QA core as proxy in memory
patsonluk f6ce0c1
Experimental QA core as proxy in memory
patsonluk 64b5293
Experimental QA core as proxy in memory
patsonluk 49cfa7b
./gradlew tidy
patsonluk 5de2a27
Comment out portion that checks for synthetic collection/core existence
patsonluk 924391a
Fixes watches and test cases
patsonluk 6772c22
Refactoring to avoid modifying existing method modifiers
patsonluk fa08d7a
Cleanup
patsonluk 0d2b744
Some refactoring to minimize changes to SolrCore
patsonluk a1582f6
javadoc
patsonluk bff8168
./gradlew tidy
patsonluk 28e5669
code cleanup
patsonluk dd259c0
code cleanup
patsonluk b8a15e7
Fix resource loader issue if configSetName is null
patsonluk bb11583
./gradlew tidy
patsonluk a32a2ac
Fixed issue with incorrect collection name in context
patsonluk 02a560f
./gradlew tidy
patsonluk ef0ed24
Correctly use <config set>_core as synthetic core name for clarity
patsonluk 46cfa39
./gradlew tidy
patsonluk 8052d83
Fixed issue with incorrect collection name in context
patsonluk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what restManager enables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is only a tiny feature called "managed resources" being powered by RestManager. It's not even reuired