-
Notifications
You must be signed in to change notification settings - Fork 818
SOLR-18144: fix schema designer to auto-create .system in 9x #4202
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| title: Fixed schema designer to create a missing .system collection. This is a regression specific to 9.x. | ||
| type: fixed # added, changed, fixed, deprecated, removed, dependency_update, security, other | ||
| authors: | ||
| - name: David Smiley | ||
| - name: Eric Pugh | ||
| - name: Jan Høydahl | ||
| links: | ||
| - name: SOLR-18144 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18144 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ | |
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.TimeoutException; | ||
|
|
@@ -72,7 +71,6 @@ | |
| import org.apache.solr.common.SolrException.ErrorCode; | ||
| import org.apache.solr.common.SolrInputDocument; | ||
| import org.apache.solr.common.cloud.DocCollection; | ||
| import org.apache.solr.common.cloud.Replica; | ||
| import org.apache.solr.common.cloud.SolrZkClient; | ||
| import org.apache.solr.common.cloud.ZkMaintenanceUtils; | ||
| import org.apache.solr.common.cloud.ZkStateReader; | ||
|
|
@@ -521,29 +519,6 @@ protected void postDataToBlobStore(CloudSolrClient cloudClient, String blobName, | |
| } | ||
| } | ||
|
|
||
| private String getBaseUrl(final String collection) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused |
||
| String baseUrl = null; | ||
| try { | ||
| Set<String> liveNodes = zkStateReader().getClusterState().getLiveNodes(); | ||
| DocCollection docColl = zkStateReader().getCollection(collection); | ||
| if (docColl != null && !liveNodes.isEmpty()) { | ||
| Optional<Replica> maybeActive = | ||
| docColl.getReplicas().stream().filter(r -> r.isActive(liveNodes)).findAny(); | ||
| if (maybeActive.isPresent()) { | ||
| baseUrl = maybeActive.get().getBaseUrl(); | ||
| } | ||
| } | ||
| } catch (Exception exc) { | ||
| log.warn("Failed to lookup base URL for collection {}", collection, exc); | ||
| } | ||
|
|
||
| if (baseUrl == null) { | ||
| baseUrl = zkStateReader().getBaseUrlForNodeName(cc.getZkController().getNodeName()); | ||
| } | ||
|
|
||
| return baseUrl; | ||
| } | ||
|
|
||
| protected String getManagedSchemaZkPath(final String configSet) { | ||
| return getConfigSetZkPath(configSet, DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME); | ||
| } | ||
|
|
@@ -658,6 +633,13 @@ void createCollection( | |
| } | ||
|
|
||
| protected CloudSolrClient cloudClient() { | ||
| // create the system collection if it doesn't exist | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doing this here means pretty minimal change to this class |
||
| try { | ||
| cc.getZkController().createSystemColl(); | ||
| } catch (Exception e) { | ||
| throw new SolrException(ErrorCode.SERVER_ERROR, "Error creating system collection", e); | ||
| } | ||
|
|
||
| return cc.getZkController().getSolrClient(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,6 @@ | |
| import java.util.Map; | ||
| import java.util.zip.ZipEntry; | ||
| import java.util.zip.ZipInputStream; | ||
| import org.apache.solr.client.solrj.request.CollectionAdminRequest; | ||
| import org.apache.solr.cloud.SolrCloudTestCase; | ||
| import org.apache.solr.common.SolrInputDocument; | ||
| import org.apache.solr.common.util.SimpleOrderedMap; | ||
|
|
@@ -60,9 +59,6 @@ public static void createCluster() throws Exception { | |
| configureCluster(1) | ||
| .addConfig(DEFAULT_CONFIGSET_NAME, new File(ExternalPaths.DEFAULT_CONFIGSET).toPath()) | ||
| .configure(); | ||
| // SchemaDesignerConfigSetHelper depends on the blob store | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yay; it's tested now. |
||
| CollectionAdminRequest.createCollection(BLOB_STORE_ID, 1, 1).process(cluster.getSolrClient()); | ||
| cluster.waitForActiveCollection(BLOB_STORE_ID, 1, 1); | ||
| } | ||
|
|
||
| @AfterClass | ||
|
|
||
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.
moved from HttpSolrCall to a more suitable place as the same logic now has 2 callers