nick-boss-tech opened a new pull request, #5087:
URL: https://github.com/apache/solr/pull/5087

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-13265
   
   ## What happens today
   
   **An add that a TLOG follower writes only to the update log is counted as an 
update error.**
   
   A TLOG replica follower can skip the IndexWriter for an added document and 
write it only to the update log. The base code still counted that add in the 
update error counter. The document was still accepted into the update log. The 
bypass path is at 
[DirectUpdateHandler2.java#L467-L470](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L467-L470).
   
   ## What this change does
   
   **Bypassed adds no longer count as update errors. Pending documents are not 
counted for them.**
   
   - A TLOG follower's add is flagged so that it skips the IndexWriter 
([DistributedUpdateProcessor.java#L509-L513](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java#L509-L513)).
   - For a flagged add, the update handler records the bypass and skips the 
error counter. The add still goes to the update log 
([DirectUpdateHandler2.java#L467-L470](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L467-L470),
 
[#L501-L507](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L501-L507)).
   - The pending-document counter is not incremented for these adds. This is 
the same as before.
   - Deletes with the same flag already return before the error counter runs. 
This change does not touch them.
   
   ## Proof
   
   **The focused test passes at this head and fails on the base code, at its 
own assertion. Verified 2026-10-07 at this head.**
   
   - Test class `SolrIndexMetricsTest`, new test 
[`testUpdatesBypassingIndexWriterAreNotErrors`](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/test/org/apache/solr/update/SolrIndexMetricsTest.java#L209-L235).
 It sends five flagged adds and checks that the update error datapoint is 
absent or zero. At this head, 3 of 3 tests in the class pass. On the base code, 
with only this test file applied, 1 of 3 fails: this test. It fails at its 
assertion, "updates that bypass the IndexWriter must not be counted as errors" 
([line 
231](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/test/org/apache/solr/update/SolrIndexMetricsTest.java#L231)),
 not in setup.
   - The assertion also passes when the datapoint is absent, so a passing run 
alone would not show that the test reads the counter. The base failure does. 
The assertion can fail only when the datapoint exists and is nonzero, so the 
datapoint is present and nonzero on base. The counter is registered as 
`solr.core.update.errors` 
([DirectUpdateHandler2.java#L298-L300](https://github.com/nick-boss-tech/solr/blob/c134b34aa27fc09b754a24d9fed65898a7dd1748/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L298-L300)).
   
   ## Limits
   
   - The test calls the update handler directly with the flag. It does not run 
a TLOG follower in SolrCloud. The flag path does not read the replica type, so 
the direct call takes the same branch. This was checked by reading, not by a 
run.
   - No adjacent items were found for this change.
   
   Changelog: `changelog/unreleased/SOLR-13265-tlog-follower-update-errors.yml`
   
   ### AI assistance
   
   AI agents assisted with research, implementation, review, and drafting. Nick 
Shanin directed the work and takes responsibility for this contribution.
   
   


-- 
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]

Reply via email to