-
Notifications
You must be signed in to change notification settings - Fork 611
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
SOLR-17269: Do not publish synthetic solr core (of Coordinator node) to ZK #2438
Open
patsonluk
wants to merge
12
commits into
apache:main
Choose a base branch
from
cowpaths:patsonluk/SOLR-17269/synthetic-solr-core
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 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 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
75 changes: 75 additions & 0 deletions
75
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,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 | ||
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.
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.
Rewrap.
Glad to see this kind of comment. Hmm; I wonder if it's actually prevented? Like how does this overall feature (which I confess knowing nothing about) actually prevent these cores from being used for anything except the one thing it needs to exist for -- distributed-search? e.g. maybe. no handlers should be loaded except those extending SearchHandler?
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.
AFAIK, this special core is restricted by the
getCoreByCollection
ofCoordinatorHttpSolrCall
/CoordinatorV2HttpSolrCall
which only accept suffix/select
.