Skip to content

Apache Lucene open-source search software

SOLR-2895: call commit tracker after doc is added

Yonik Seeley67478264b523
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
index 382350d4e43..9b1515ed93a 100644
--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
@@ -143,7 +143,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
try {
- softCommitTracker.addedDocument( -1 ); // TODO: support commitWithin with soft update
if (cmd.overwrite) {
Term updateTerm;
@@ -171,13 +170,15 @@ public class DirectUpdateHandler2 extends UpdateHandler {
// allow duplicates
writer.addDocument(cmd.getLuceneDocument());
}
- commitTracker.addedDocument( cmd.commitWithin );
// Add to the transaction log *after* successfully adding to the index, if there was no error.
// This ordering ensures that if we log it, it's definitely been added to the the index.
// This also ensures that if a commit sneaks in-between, that we know everything in a particular
// log version was definitely committed.
ulog.add(cmd);
+ softCommitTracker.addedDocument( -1 ); // TODO: support commitWithin with soft update
+ commitTracker.addedDocument( cmd.commitWithin );
+
rc = 1;
} finally {
if (rc!=1) {