Skip to content

Commit

Permalink
Fixes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
patsonluk committed Jun 10, 2024
1 parent dbfcbaa commit ac662a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ public ZkConfigSetService(SolrZkClient zkClient) {

@Override
public SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd) {
// The configSet is read from ZK and populated. Ignore CD's pre-existing configSet; only
// populated in standalone
//
// Currently, cd.getConfigSet() is always null. Except that it's explicitly set by
// {@link org.apache.solr.core.SyntheticSolrCore}.
// Should we consider setting it for all cores as a part of CoreDescriptor creation/loading
Expand Down
14 changes: 3 additions & 11 deletions solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

package org.apache.solr.core;

import java.nio.file.Paths;
import java.util.HashMap;
import java.nio.file.Path;
import java.util.Map;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CoreAdminParams;
Expand All @@ -40,14 +39,12 @@ public SyntheticSolrCore(CoreContainer coreContainer, CoreDescriptor cd, ConfigS

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);
Map<String, String> coreProps = Map.of(CoreAdminParams.COLLECTION, syntheticCoreName);

CoreDescriptor syntheticCoreDescriptor =
new CoreDescriptor(
syntheticCoreName,
Paths.get(coreContainer.getSolrHome() + "/" + syntheticCoreName),
Path.of(coreContainer.getSolrHome(), syntheticCoreName),
coreProps,
coreContainer.getContainerProperties(),
coreContainer.getZkController());
Expand Down Expand Up @@ -75,9 +72,4 @@ protected RestManager initRestManager() throws SolrException {
// We do not expect RestManager ops on Coordinator Nodes
return new RestManager();
}

@Override
public void close() {
super.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static SolrCore getCore(
}

String confName = coll.getConfigName();
syntheticCoreName = getSyntheticCoreName(confName);
syntheticCoreName = getSyntheticCoreNameFromConfig(confName);

SolrCore syntheticCore;
synchronized (CoordinatorHttpSolrCall.class) {
Expand Down Expand Up @@ -139,12 +139,12 @@ public static SolrCore getCore(
}
}

public static String getSyntheticCollectionName(String configName) {
public static String getSyntheticCollectionNameFromConfig(String configName) {
return SYNTHETIC_COLL_PREFIX + configName;
}

public static String getSyntheticCoreName(String configName) {
return getSyntheticCollectionName(configName) + "_core";
public static String getSyntheticCoreNameFromConfig(String configName) {
return getSyntheticCollectionNameFromConfig(configName) + "_core";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ public void testSimple() throws Exception {

assertEquals(10, rslt.getResults().size());

String SYNTHETIC_COLLECTION = CoordinatorHttpSolrCall.getSyntheticCollectionName("conf");
String SYNTHETIC_COLLECTION =
CoordinatorHttpSolrCall.getSyntheticCollectionNameFromConfig("conf");
DocCollection collection =
cluster.getSolrClient().getClusterStateProvider().getCollection(SYNTHETIC_COLLECTION);
// this should be empty as synthetic collection does not register with ZK
assertNull(collection);

String syntheticCoreName = CoordinatorHttpSolrCall.getSyntheticCoreName("conf");
String syntheticCoreName = CoordinatorHttpSolrCall.getSyntheticCoreNameFromConfig("conf");
try (SolrCore syntheticCore =
coordinatorJetty.getCoreContainer().getCore(syntheticCoreName)) {
assertNotNull(syntheticCore);
Expand Down

0 comments on commit ac662a3

Please sign in to comment.