dnhatn commented on a change in pull request #1350: Cleanup DWPT for readability
URL: https://github.com/apache/lucene-solr/pull/1350#discussion_r392589649
##########
File path:
lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
##########
@@ -249,34 +247,19 @@ public long updateDocuments(Iterable<? extends
Iterable<? extends IndexableField
reserveOneDoc();
docState.doc = doc;
docState.docID = numDocsInRAM;
- docCount++;
-
- boolean success = false;
try {
consumer.processDocument();
- success = true;
} finally {
- if (!success) {
- // Incr here because finishDocument will not
- // be called (because an exc is being thrown):
- numDocsInRAM++;
- }
+ numDocsInRAM++; // we count the doc anyway even in the case of an
exception
}
-
- numDocsInRAM++;
}
allDocsIndexed = true;
- return finishDocuments(deleteNode, docCount);
+ return finishDocuments(deleteNode, docsInRamBefore);
} finally {
if (!allDocsIndexed && !aborted) {
// the iterator threw an exception that is not aborting
// go and mark all docs from this block as deleted
- int docID = numDocsInRAM - 1;
- final int endDocID = docID - docCount;
- while (docID > endDocID) {
- deleteDocID(docID);
- docID--;
- }
+ deleteLastDocs(numDocsInRAM-docsInRamBefore);
Review comment:
nit: add spaces around `-`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]