syahra712 opened a new pull request, #151: URL: https://github.com/apache/solr-orbit/pull/151
### Description `SolrBulkIndex` reports the wrong `weight` when a batch fails. `total_docs` was only increased after `sc.add` succeeded, and then `weight = total_docs - errors` subtracted the failed documents a second time. For example, with `bulk-size: 1` and two documents where the second batch fails: | | before | after | |---|---|---| | `weight` | 0 | 1 | | `bulk-size` | 1 | 2 | | `error-count` | 1 | 1 | If every batch fails, `weight` was negative (`-N`). The executor uses `weight` as the sample's `total_ops` (`execute_single` in `worker_coordinator.py`), so this went straight into indexing throughput. The fix counts every document sent in `total_docs`, before the `try`. `weight = total_docs - errors` then gives the number of documents Solr accepted, which is what the existing code meant, and `bulk-size` is the size of the request. Nothing changes when no batch fails. ### Issues Resolved None filed. I found it while reading the runner. ### Testing - [x] New functionality includes testing Two new tests in `tests/unit/solr/test_runner.py`: - `test_partial_failure_counts_failed_docs_once`: one batch succeeds and one fails, giving `weight` 1, `bulk-size` 2 and `error-count` 1. - `test_failed_bulk_has_zero_weight`: every batch fails, giving `weight` 0, where it used to be -1. Both fail on `main` and pass with the fix. The full `tests/` suite passes locally on Python 3.13 (1177 passed, 5 skipped), and so does `ruff check .`. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
