mirror of https://github.com/apache/lucene.git
SOLR-4965: skip IW.commit if no changes
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1497075 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b9e1537a7e
commit
811079b8c6
|
@ -540,11 +540,17 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
|
|||
}
|
||||
|
||||
// SolrCore.verbose("writer.commit() start writer=",writer);
|
||||
final Map<String,String> commitData = new HashMap<String,String>();
|
||||
commitData.put(SolrIndexWriter.COMMIT_TIME_MSEC_KEY,
|
||||
String.valueOf(System.currentTimeMillis()));
|
||||
writer.setCommitData(commitData);
|
||||
writer.commit();
|
||||
|
||||
if (writer.hasUncommittedChanges()) {
|
||||
final Map<String,String> commitData = new HashMap<String,String>();
|
||||
commitData.put(SolrIndexWriter.COMMIT_TIME_MSEC_KEY,
|
||||
String.valueOf(System.currentTimeMillis()));
|
||||
writer.setCommitData(commitData);
|
||||
writer.commit();
|
||||
} else {
|
||||
log.info("No uncommitted changes. Skipping IW.commit.");
|
||||
}
|
||||
|
||||
// SolrCore.verbose("writer.commit() end");
|
||||
numDocsPending.set(0);
|
||||
callPostCommitCallbacks();
|
||||
|
|
Loading…
Reference in New Issue