Skip to content

SOLR-16130: Add cross-collection export regression test - #5004

Open
nick-boss-tech wants to merge 3 commits into
apache:mainfrom
nick-boss-tech:solr-16130-test-followup
Open

nick-boss-tech wants to merge 3 commits into
apache:mainfrom
nick-boss-tech:solr-16130-test-followup

Conversation

@nick-boss-tech

@nick-boss-tech nick-boss-tech commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖 (posted on behalf of Nick Shanin)

https://issues.apache.org/jira/browse/SOLR-16130

What happens today

The reported symptom: a cross-collection join returns no documents when the from-collection's /export result ends with a segment that has no matches. The root cause (a null per-leaf bitset reaching ExportWriter.topDocs()) was fixed and merged in #4953 (SOLR-8291). This PR contains no production change; it adds the regression test for the reported scenario, which nothing covered.

What this change does

CrossCollectionJoinQueryTest.testCcJoinWithTrailingUnmatchedExportSegment indexes matching documents, commits, then indexes non-matching documents and commits again, producing the trailing unmatched segment, and asserts the cross-collection join returns the 4 matching documents. The test also asserts that the from core still holds at least two segments (one per commit, so the layout the scenario needs cannot silently merge away) and that the returned documents are exactly the four expected ids (to-0 through to-3). The ccjoin test configset enables useFilterForSortedQuery, which routes /export through the sortDocSet path that skips getLeafCollector for trailing unmatched leaves (the path from the #4953 analysis). Only CrossCollectionJoinQueryTest uses that configset. Enabling useFilterForSortedQuery in that configset changes the configuration for every test in the class, not just the new one: the whole class now runs with the filter path on.

Proof

Verified at head 3c48dec on 2026-10-06 (tidy clean, Error Prone compile clean, :solr:core:check -x test green; GitHub Actions corroboration run 37581056636 dispatched for the class at this head).

  • Fail-before, run on 2026-10-06 against 70c1a28995d (the parent of the SOLR-8291, SOLR-13217: Skip null per-leaf export bitsets #4953 guard commit 56ec140e363) with only this PR's test and configset applied: the new test fails, and the server log records exactly the null-bitset error the guard prevents: java.lang.NullPointerException: Cannot invoke "org.apache.lucene.util.BitSet.length()" because "bits" is null at ExportWriter$SegmentIterator.topDocs; the broken export stream then fails the join query with SolrServerException: No live SolrServers available to handle this request. With the guard (already on main), CrossCollectionJoinQueryTest passes 10/10, the new test included.

Limits

The test covers the one reported scenario: a trailing unmatched export segment on the sorted export path. Other export and join shapes are covered by the existing suite, not by this test. The fix itself is not in this PR; it merged separately in #4953.

AI assistance

AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant