[ https://issues.apache.org/jira/browse/STORM-1419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15083280#comment-15083280 ]
ASF GitHub Bot commented on STORM-1419: --------------------------------------- Github user dossett commented on a diff in the pull request: https://github.com/apache/storm/pull/977#discussion_r48859729 --- Diff: external/storm-solr/src/main/java/org/apache/storm/solr/bolt/SolrUpdateBolt.java --- @@ -92,11 +94,19 @@ private void ack(Tuple tuple) throws SolrServerException, IOException { if (commitStgy == null) { collector.ack(tuple); } else { - toCommitTuples.add(tuple); - commitStgy.update(); - if (commitStgy.commit()) { + if (TupleUtils.isTick(tuple)) { + LOG.debug("TICK! forcing solr client commit"); + collector.ack(tuple); + commitStgy.commit(); solrClient.commit(solrMapper.getCollection()); ackCommittedTuples(); + } else { + toCommitTuples.add(tuple); + commitStgy.update(); + if (commitStgy.commit()) { --- End diff -- The strategy in AbstractHdfsBolt is to set a boolean in the case of a tick tuple and then sync if that value is true or if other conditions dictate a sync. (https://github.com/apache/storm/blob/master/external/storm-hdfs/src/main/java/org/apache/storm/hdfs/bolt/AbstractHdfsBolt.java#L154) The benefit of that approach is to eliminate duplicate code (i.e. that calls to ackCommittedTuples() and solrClient.commit()), which I think is a substantial benefit. Here that would looks something like: ```code if (forceCommit || commitStgy.commit()) { solrClient.commit(solrMapper.getCollection()); ackCommittedTuples(); } ``` With duplicate code removed I would be +1 A unit test would also be helpful. HdfsBolt example is here: https://github.com/apache/storm/blob/master/external/storm-hdfs/src/test/java/org/apache/storm/hdfs/bolt/TestHdfsBolt.java#L175 > Solr bolt should handle tick tuples > ----------------------------------- > > Key: STORM-1419 > URL: https://issues.apache.org/jira/browse/STORM-1419 > Project: Apache Storm > Issue Type: Bug > Components: storm-solr > Reporter: Xin Wang > Assignee: Xin Wang > > Solr bolt should handle tick tuples. > Forcing solr client commit when bolt received tick tuple. -- This message was sent by Atlassian JIRA (v6.3.4#6332)