Repository navigation
Count failed bulk-index batches once in the reported weight - #151
Merged
Merged
Conversation
total_docs only counted batches that Solr accepted, and the weight then subtracted the failed documents again. A bulk with one failed batch out of two reported 0 docs, and a fully failed bulk reported a negative count, which fed straight into indexing throughput. total_docs now counts every document sent, so bulk-size is the request size and weight is the number of documents indexed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SolrBulkIndexreports the wrongweightwhen a batch fails.total_docswas only increased aftersc.addsucceeded, and thenweight = total_docs - errorssubtracted the failed documents a second time. For example, withbulk-size: 1and two documents where the second batch fails:weightbulk-sizeerror-countIf every batch fails,
weightwas negative (-N). The executor usesweightas the sample'stotal_ops(execute_singleinworker_coordinator.py), so this went straight into indexing throughput.The fix counts every document sent in
total_docs, before thetry.weight = total_docs - errorsthen gives the number of documents Solr accepted, which is what the existing code meant, andbulk-sizeis the size of the request. Nothing changes when no batch fails.Issues Resolved
None filed. I found it while reading the runner.
Testing
Two new tests in
tests/unit/solr/test_runner.py:test_partial_failure_counts_failed_docs_once: one batch succeeds and one fails, givingweight1,bulk-size2 anderror-count1.test_failed_bulk_has_zero_weight: every batch fails, givingweight0, where it used to be -1.Both fail on
mainand pass with the fix. The fulltests/suite passes locally on Python 3.13 (1177 passed, 5 skipped), and so doesruff check ..By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.