-
Notifications
You must be signed in to change notification settings - Fork 735
SOLR-17269: Do not publish synthetic solr core (of Coordinator node) to ZK #2438
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
Merged
dsmiley
merged 15 commits into
apache:main
from
cowpaths:patsonluk/SOLR-17269/synthetic-solr-core
Jun 17, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3899231
In-memory synthetic `SolrCore` for QA node (#181)
patsonluk 3667958
Solve merge issue
patsonluk c28cc87
./gradlew tidy
patsonluk 9511546
Added License
patsonluk 08eebe5
Added to test case to ensure the sync collection is not in cluster st…
patsonluk 22fd7dc
Refactoring after code review
patsonluk 8e0240d
Code review changes
patsonluk 7be2234
Merge branch 'apache-main' into patsonluk/SOLR-17269/synthetic-solr-core
patsonluk 06273ac
Simplify the ZkConfigSetService#setConfigMetadata, remove the auto cr…
patsonluk 7d41702
./gradlew tidy
patsonluk dbfcbaa
Improved comment
patsonluk ac662a3
Fixes after code review
patsonluk 50ab061
Removed logic that registers the synthetic collection/core of Coordin…
patsonluk 5bf0a06
Merge remote-tracking branch 'fullstory/patsonluk/SOLR-17269/syntheti…
patsonluk 1bdb1cc
Updated CHANGES.txt after review
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 hidden or 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 hidden or 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 hidden or 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
75 changes: 75 additions & 0 deletions
75
solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java
This file contains hidden or 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,75 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.solr.core; | ||
|
||
import java.nio.file.Path; | ||
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 = Map.of(CoreAdminParams.COLLECTION, syntheticCoreName); | ||
|
||
CoreDescriptor syntheticCoreDescriptor = | ||
new CoreDescriptor( | ||
syntheticCoreName, | ||
Path.of(coreContainer.getSolrHome(), syntheticCoreName), | ||
coreProps, | ||
coreContainer.getContainerProperties(), | ||
coreContainer.getZkController()); | ||
syntheticCoreDescriptor.setConfigSet(configSetName); | ||
ConfigSet coreConfig = | ||
coreContainer.getConfigSetService().loadConfigSet(syntheticCoreDescriptor); | ||
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 | ||
dsmiley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return new RestManager(); | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.