[ https://issues.apache.org/jira/browse/OAK-9015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17088626#comment-17088626 ]
Nitin Gupta commented on OAK-9015: ---------------------------------- Merged in trunk : [https://svn.apache.org/viewvc?view=revision&revision=1876791] After discussion on PR [https://github.com/oak-indexing/jackrabbit-oak/pull/133] > ElasticserachIndexWriter#close method implementation doesn't do what the > underlying contract expects | BulkProcessor resource is never closed and it > always returns false > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: OAK-9015 > URL: https://issues.apache.org/jira/browse/OAK-9015 > Project: Jackrabbit Oak > Issue Type: Bug > Reporter: Nitin Gupta > Assignee: Nitin Gupta > Priority: Major > > A new ElasticserachIndexWriter instance is created everytime the async > indexer service runs and the close() method in the FullTextWriter interface > has the following contract > > {code:java} > /** > * Closes the underlying resources. > * > * @param timestamp timestamp to be used for recording at status in > NodeBuilder > * @return true if index was updated or any write happened. > */ > boolean close(long timestamp) throws IOException; > {code} > However the implementation in ElasticserachIndexWriter returns false always > and doesn't closes the BulkProcessor instances created. > > The problem that needs to be handled here is that the bulk processor calls to > elastic server are async in nature and the close method in > ElasticserachIndexWriter could be called before the bulkProcessor completed > it work. So we need to find a safe way to close the bulkProcessor and return > true/false from ElasticserachIndexWriter#close() depending upon if the index > was updated or not. > > Looking at [0], both the bulkProcessor.close and awaitClose methods close the > bulkPocessor after flushing all the documents that were loaded to the > bulkProcessor till that moment. So we just need to make sure that, all the > needed docs should be loaded in the bulkProcessor when > ElasticserachIndexWriter#close() is called. > > [0]: > [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-bulk-processor.html] -- This message was sent by Atlassian Jira (v8.3.4#803005)