Skip to content

SOLR-18687: CrossDC - fix broken expandDbq=expand option. - #5388

Open
sigram wants to merge 3 commits into
apache:mainfrom
sigram:jira/solr-18687-crossdc-expandDbq-fix
Open

sigram wants to merge 3 commits into
apache:mainfrom
sigram:jira/solr-18687-crossdc-expandDbq-fix

Conversation

@sigram

@sigram sigram commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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

Fix CrossDC delete-by-query expansion failing with HTTP 500

With solr.crossdc.expandDbq=expand (the default), the CrossDC producer failed every delete-by-query except *:* with an HTTP 500 caused by a NullPointerException. MirroringUpdateProcessor.processDelete ran its cursorMark query and the follow-up deleteById through CoreContainer.getDefaultHttpSolrClient(). That client has no base URL, so building the request URL throws. The delete was not applied on the source either, so nothing was deleted or mirrored. The workaround was -Dsolr.crossdc.expandDbq=none.

The regression came in with SOLR-16503 (98906f41a5). Before it, this code built its own HttpSolrClient pointed at the node's base URL. The refactor swapped in the shared default client, which is meant for requestWithBaseUrl(...). Nothing caught it because the only real-cluster test of expansion (DeleteByQueryToIdTest.testExpandDBQ) has been @Ignored since the module was absorbed, and the unit tests mock the client.

The fix uses getZkController().getSolrClient(), the ZooKeeper-aware CloudSolrClient, for both the query and the delete-by-id requests.

MirroringDbqExpansionCloudTest is new and runs the expansion against a real 3-node cluster without Kafka or Docker. It covers expand, none, the default, *:* (never expanded), and a delete that needs several cursor pages. To plug in a recording factory it adds a ${solr.crossdc.processorFactory:...} property default to the cloud-minimal solrconfig.xml. Behavior is unchanged when the property is unset. Delete requests are sent to random nodes in the cluster to eliminate potential bugs related to data locality.

🤖 Generated with Claude Code (Opus 5.5), reviewed and tweaked by an actual human ;)

@sigram sigram added this to the 10.x milestone Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).

…warded to the leader, which skips

the MirroringUpdateProcessor in the chain, and these deletes are not mirrored as a result.
Instead send DBI-s without mirroring just for local processing at the source cluster, and accumulate the
doc-ids locally and mirror the accumulated page of id-s directly from the non-leader replica that is
doing the expansion.
@epugh

epugh commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

I appreciate when my distrust of mocks is borne out: _ unit tests mock the client_

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.

2 participants