gerlowskija commented on code in PR #3031:
URL: https://github.com/apache/solr/pull/3031#discussion_r1915099312
##########
solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java:
##########
@@ -494,62 +498,59 @@ protected void validateTypeChange(String configSet,
SchemaField field, FieldType
SolrException.ErrorCode.BAD_REQUEST,
"Cannot change type of the _version_ field; it must be a plong.");
}
- List<SolrInputDocument> docs = getStoredSampleDocs(configSet);
+ List<SolrInputDocument> docs = retrieveSampleDocs(configSet);
if (!docs.isEmpty()) {
schemaSuggester.validateTypeChange(field, toType, docs);
}
}
void deleteStoredSampleDocs(String configSet) {
- try {
- cloudClient().deleteByQuery(BLOB_STORE_ID, "id:" + configSet +
"_sample/*", 10);
- } catch (IOException | SolrServerException | SolrException exc) {
- final String excStr = exc.toString();
- log.warn("Failed to delete sample docs from blob store for {} due to:
{}", configSet, excStr);
- }
+ String path =
+ "blob" + "/" + configSet
+ + "_sample"; // needs to be made unique to support multiple
uploads. Maybe hash the
+ // docs?
+ // why do I have to do this in two stages?
+ DistribFileStore.deleteZKFileEntry(cc.getZkController().getZkClient(),
path);
+ cc.getFileStore().delete(path);
}
+ // I don't like this guy just hanging out here to support retrieveSampleDocs.
+ List<SolrInputDocument> docs = Collections.emptyList();
+
@SuppressWarnings("unchecked")
- List<SolrInputDocument> getStoredSampleDocs(final String configSet) throws
IOException {
- List<SolrInputDocument> docs = null;
+ List<SolrInputDocument> retrieveSampleDocs(final String configSet) throws
IOException {
- final URI uri;
- try {
- uri =
- collectionApiEndpoint(BLOB_STORE_ID, "blob", configSet + "_sample")
- .setParameter(CommonParams.WT, "filestream")
- .build();
- } catch (URISyntaxException e) {
- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
- }
+ String path =
+ "blob" + "/" + configSet
Review Comment:
[0] Might be nice to make the "blob/" bit here and other similar path
segments constants, that can be reused on both the storage and retrieval side
of this helper code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]