solr icon indicating copy to clipboard operation
solr copied to clipboard

SOLR-17504: CoreContainer calls UpdateHandler.commit.

Open bruno-roustant opened this issue 1 year ago • 0 comments

https://issues.apache.org/jira/browse/SOLR-17504

Description

This proposal is about unifying calls to UpdateHandler.commit.

CoreContainer.reload may call directly IndexWriter.commit if the core to reload is readonly (property of the Collection). This is an issue because it bypasses some logic in UpdateHandler.commit. In addition, the current code commits without taking the commit lock.

DirectUpdateHandler2.closeWriter may commit if the update log is not empty (not committed yet). But it does not call DirectUpdateHandler2.commit(), it copies commit() code instead for some reasons (comments in the code mention test failures).

Solution

Make CoreContainer.reload call UpdateHandler.commit.

Add the same call to DirectUpdateHandler2.shouldCommit() as in the commit() method, otherwise commit metadata are lost. In addition shouldCommit() can be extended correctly, for example in the solr-sandbox encryption module which needs to intercept calls to shouldCommit().

Tests

A new DirectUpdateHandlerWithUpdateLogTest is added to test specifically that the UpdateHandler.shouldCommit hook is called. It's a new test because it requires the update log to test the UpdateHandler.closeWriter logic, but DirectUpdateHandlerTest does not support the update log.

bruno-roustant avatar Oct 21 '24 15:10 bruno-roustant