nick-boss-tech opened a new pull request, #5082: URL: https://github.com/apache/solr/pull/5082
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-11475 ## What happens today **PeerSync loops forever when both replicas hold the same version with opposite signs.** PeerSync compares its own recent updates with the versions another replica reports. The same version can appear on both sides with opposite signs: an add on one side, a delete on the other. The comparison loop then never moves past that pair. It keeps adding the same range string until memory runs out ([loop](https://github.com/nick-boss-tech/solr/blob/0de48e492fd49a15f406b2a5500c337f92ef3d4d/solr/core/src/java/org/apache/solr/update/PeerSync.java#L805-L844)). ## What this change does **The loop steps past a version that appears on both sides with opposite signs.** When the two absolute values match, the loop moves both positions down one step and requests nothing for that pair ([new branch](https://github.com/nick-boss-tech/solr/blob/0de48e492fd49a15f406b2a5500c337f92ef3d4d/solr/core/src/java/org/apache/solr/update/PeerSync.java#L826-L832)). The other branches of the loop are unchanged ([loop](https://github.com/nick-boss-tech/solr/blob/0de48e492fd49a15f406b2a5500c337f92ef3d4d/solr/core/src/java/org/apache/solr/update/PeerSync.java#L805-L844)). ## Proof **Five PeerSync test classes pass with this change. A fail-before run is inconclusive, because the old code never ends on this input.** - Five classes, 1 of 1 each: `PeerSyncTest`, `PeerSyncWithLeaderTest`, `PeerSyncWithBufferUpdatesTest`, `PeerSyncWithIndexFingerprintCachingTest`, and `PeerSyncWithLeaderAndIndexFingerprintCachingTest`. Five tests in total, 0 failures. - `PeerSyncWithLeaderTest` declares no test method of its own and runs the `test()` of `PeerSyncTest`. `PeerSyncWithLeaderAndIndexFingerprintCachingTest` runs the `test()` of `PeerSyncWithIndexFingerprintCachingTest`, which is a separate class. - The new check is [`testHandleVersionsWithRangesSameVersionDifferentSign`](https://github.com/nick-boss-tech/solr/blob/0de48e492fd49a15f406b2a5500c337f92ef3d4d/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java#L453-L481). It runs from `test()` in `PeerSyncTest` through `handleVersionsWithRangesTests()`, so it runs in `PeerSyncTest` and in `PeerSyncWithLeaderTest`. It runs the walk on a thread and fails if the walk has not ended after 30 seconds. - On the code before the fix, this input never ends. So a run cannot show a clean failure. The test comment says so ([comment](https://github.com/nick-boss-tech/solr/blob/0de48e492fd49a15f406b2a5500c337f92ef3d4d/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java#L454-L457)). - Verified 2026-10-08 at this head. ## A choice to check **The loop steps over the pair and does not request it.** The other route requests the other side's version of that update, so this replica fetches it. This branch steps over the pair instead. The cost is that this replica does not fetch the other side's version through this walk. Was stepping over the pair the right call, or should the other side's version be requested? ## Limits - The test calls the PeerSync helper directly. It does not run a peer sync between nodes. - The test covers one set of versions, run with both settings of the complete-list flag. Other arrangements of a same-version pair are not tested. Changelog: `changelog/unreleased/SOLR-11475-peersync-version-ranges-loop.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]
