SOLR-2895: call commit tracker after doc is added

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1202428 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-11-15 21:26:54 +00:00
parent f865f7935e
commit 67478264b5
1 changed files with 3 additions and 2 deletions

View File

@ -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) {