-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
STORM-2508:storm-solr enhancement: update solrj to 5.5, support custom SolrClientFactory and commit operation #2108
Conversation
storm-solr enhancement: update solrj to 5.5, support custom SolrClientFactory and commit operation
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.
Thanks for the contribution @AleiHanami. I left a few comments, but the changes look reasonable. Could you open a PR against master as well, since we need changes to go there first?
@@ -0,0 +1,30 @@ | |||
/* | |||
* DefaultCloudSolrClientFactory.java |
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.
Please replace this license header with the Apache header (copy it from one of the other files)
* default implementation of {@link SolrClientFactory}, which takes a zookeeper host | ||
* and produce {@link org.apache.solr.client.solrj.impl.CloudSolrClient} with the host. | ||
* | ||
* @author alei |
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.
Please remove the author.
import java.util.Map; | ||
|
||
/** | ||
* <p>this Class build the {@link Schema} by Solr Schema API.</p> |
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.
Is there any reason to prefer the REST schema builder over this one? Otherwise maybe we should remove the other one?
Schema converted = new Schema(); | ||
converted.setUniqueKey(representation.getUniqueKey()); | ||
converted.setName(representation.getName()); | ||
converted.setVersion(String.valueOf(representation.getVersion())); |
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.
Nit: If this is a float, shouldn't we keep it that way in Schema?
FieldType fieldType = new FieldType(); | ||
fieldType.setClazz(type.getAttributes().get("class").toString()); | ||
if (type.getAttributes().get("multiValued") != null) { | ||
fieldType.setMultiValued(Boolean.valueOf(type.getAttributes().get("multiValued").toString())); |
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.
Is this attribute already a boolean? If so I don't think there's a reason to toString and then Boolean.valueOf it.
new ArrayList<>(representation.getFields().size()); | ||
for (Map<String, Object> field : representation.getFields()) { | ||
org.apache.storm.solr.schema.Field schemaField = new org.apache.storm.solr.schema.Field(); | ||
schemaField.setName(field.get("name").toString()); |
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.
Nit: An explicit cast to String might be nicer here, so you get an exception in case this isn't a String for some reason.
return schema; | ||
} | ||
|
||
private Schema convert(final SchemaRepresentation representation) { |
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.
Nit: It might be good to add a unit test for this, to verify that this conversion does the right thing.
*/ | ||
public interface CommitCallback extends Serializable { | ||
|
||
void process(SolrClient solrClient, String collection) throws SolrServerException, IOException; |
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.
Nit: Shouldn't this be named "commit"?
@@ -46,13 +46,13 @@ | |||
<dependency> | |||
<groupId>org.apache.solr</groupId> | |||
<artifactId>solr-solrj</artifactId> | |||
<version>5.2.1</version> | |||
<version>5.5.0</version> |
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.
5.5.0 version is affected by a security problem and is also more than 1.5 years old.
http://lucene.apache.org/solr/news.html
Please consider moving to Solr 6.5.1 or 6.6.0
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.solr</groupId> | ||
<artifactId>solr-test-framework</artifactId> | ||
<version>5.2.1</version> | ||
<version>5.5.0</version> |
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.
To avoiding adding version everywhere, this should be made a property
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.
Solr version changes requested
We are closing stale Pull Requests to make the list more manageable. Please re-open any Pull Request that has been closed in error. Closes apache#608 Closes apache#639 Closes apache#640 Closes apache#648 Closes apache#662 Closes apache#668 Closes apache#692 Closes apache#705 Closes apache#724 Closes apache#728 Closes apache#730 Closes apache#753 Closes apache#803 Closes apache#854 Closes apache#922 Closes apache#986 Closes apache#992 Closes apache#1019 Closes apache#1040 Closes apache#1041 Closes apache#1043 Closes apache#1046 Closes apache#1051 Closes apache#1078 Closes apache#1146 Closes apache#1164 Closes apache#1165 Closes apache#1178 Closes apache#1213 Closes apache#1225 Closes apache#1258 Closes apache#1259 Closes apache#1268 Closes apache#1272 Closes apache#1277 Closes apache#1278 Closes apache#1288 Closes apache#1296 Closes apache#1328 Closes apache#1342 Closes apache#1353 Closes apache#1370 Closes apache#1376 Closes apache#1391 Closes apache#1395 Closes apache#1399 Closes apache#1406 Closes apache#1410 Closes apache#1422 Closes apache#1427 Closes apache#1443 Closes apache#1462 Closes apache#1468 Closes apache#1483 Closes apache#1506 Closes apache#1509 Closes apache#1515 Closes apache#1520 Closes apache#1521 Closes apache#1525 Closes apache#1527 Closes apache#1544 Closes apache#1550 Closes apache#1566 Closes apache#1569 Closes apache#1570 Closes apache#1575 Closes apache#1580 Closes apache#1584 Closes apache#1591 Closes apache#1600 Closes apache#1611 Closes apache#1613 Closes apache#1639 Closes apache#1703 Closes apache#1711 Closes apache#1719 Closes apache#1737 Closes apache#1760 Closes apache#1767 Closes apache#1768 Closes apache#1785 Closes apache#1799 Closes apache#1822 Closes apache#1824 Closes apache#1844 Closes apache#1874 Closes apache#1918 Closes apache#1928 Closes apache#1937 Closes apache#1942 Closes apache#1951 Closes apache#1957 Closes apache#1963 Closes apache#1964 Closes apache#1965 Closes apache#1967 Closes apache#1968 Closes apache#1971 Closes apache#1985 Closes apache#1986 Closes apache#1998 Closes apache#2031 Closes apache#2032 Closes apache#2071 Closes apache#2076 Closes apache#2108 Closes apache#2119 Closes apache#2128 Closes apache#2142 Closes apache#2174 Closes apache#2206 Closes apache#2297 Closes apache#2322 Closes apache#2332 Closes apache#2341 Closes apache#2377 Closes apache#2414 Closes apache#2469
We are closing stale Pull Requests to make the list more manageable. Please re-open any Pull Request that has been closed in error. Closes apache#608 Closes apache#639 Closes apache#640 Closes apache#648 Closes apache#662 Closes apache#668 Closes apache#692 Closes apache#705 Closes apache#724 Closes apache#728 Closes apache#730 Closes apache#753 Closes apache#803 Closes apache#854 Closes apache#922 Closes apache#986 Closes apache#992 Closes apache#1019 Closes apache#1040 Closes apache#1041 Closes apache#1043 Closes apache#1046 Closes apache#1051 Closes apache#1078 Closes apache#1146 Closes apache#1164 Closes apache#1165 Closes apache#1178 Closes apache#1213 Closes apache#1225 Closes apache#1258 Closes apache#1259 Closes apache#1268 Closes apache#1272 Closes apache#1277 Closes apache#1278 Closes apache#1288 Closes apache#1296 Closes apache#1328 Closes apache#1342 Closes apache#1353 Closes apache#1370 Closes apache#1376 Closes apache#1391 Closes apache#1395 Closes apache#1399 Closes apache#1406 Closes apache#1410 Closes apache#1422 Closes apache#1427 Closes apache#1443 Closes apache#1462 Closes apache#1468 Closes apache#1483 Closes apache#1506 Closes apache#1509 Closes apache#1515 Closes apache#1520 Closes apache#1521 Closes apache#1525 Closes apache#1527 Closes apache#1544 Closes apache#1550 Closes apache#1566 Closes apache#1569 Closes apache#1570 Closes apache#1575 Closes apache#1580 Closes apache#1584 Closes apache#1591 Closes apache#1600 Closes apache#1611 Closes apache#1613 Closes apache#1639 Closes apache#1703 Closes apache#1711 Closes apache#1719 Closes apache#1737 Closes apache#1760 Closes apache#1767 Closes apache#1768 Closes apache#1785 Closes apache#1799 Closes apache#1822 Closes apache#1824 Closes apache#1844 Closes apache#1874 Closes apache#1918 Closes apache#1928 Closes apache#1937 Closes apache#1942 Closes apache#1951 Closes apache#1957 Closes apache#1963 Closes apache#1964 Closes apache#1965 Closes apache#1967 Closes apache#1968 Closes apache#1971 Closes apache#1985 Closes apache#1986 Closes apache#1998 Closes apache#2031 Closes apache#2032 Closes apache#2071 Closes apache#2076 Closes apache#2108 Closes apache#2119 Closes apache#2128 Closes apache#2142 Closes apache#2174 Closes apache#2206 Closes apache#2297 Closes apache#2322 Closes apache#2332 Closes apache#2341 Closes apache#2377 Closes apache#2414 Closes apache#2469
I have a case that the SolrCloud in my organization is protected by SSL + Basic Auth, so I need to provide customized SolrClient instance to SolrUpdateBolt. Likewise, the RestJsonSchemaBuilder cannot access Schema API without auth.
In addition, for "near real-time search", soft commit is preferred, so it is better to expose an interface for user to customize commit operation.
I think those features will also be useful for other people who needs to use custom SolrClient implementation and control the detail of commit operation. So, finally, I plan an enhancement for storm-solr: