Skip to content

SOLR-18351: remove ContentStream from SolrJ's client write path - #4811

Open
serhiy-bzhezytskyy wants to merge 2 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18351-contentstream-investigation
Open

SOLR-18351: remove ContentStream from SolrJ's client write path#4811
serhiy-bzhezytskyy wants to merge 2 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18351-contentstream-investigation

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor

Removes ContentStream from SolrJ's client write path in favor of ContentWriter, per the ticket. This required solving the multipart gap flagged in my earlier comment: ContentWriter only supported a single stream, and ContentStreamUpdateRequest (Solr Cell/Tika uploads, bin/solr configset upload) falls back to the deprecated getContentStreams() whenever more than one stream is added.

Added RequestWriter.MultipartContentWriter -- a marker sub-interface of ContentWriter exposing List<NamedPart> (name + a per-part ContentWriter). HttpJettySolrClient builds a real multipart/form-data body from it (verified end-to-end with a new test against a real Jetty server: HttpJettySolrClientTest#testMultipartUpload). HttpJdkSolrClient keeps its existing behavior of rejecting multipart outright (it never supported it).

Removed the now-dead getContentStreams() overrides across the client write path: SolrRequest, RequestWriter (+ its two implementations), WrappedSolrRequest, ContentStreamUpdateRequest, ConfigSetAdminRequest.Upload (was already fully covered by getContentWriter()), and the cross-dc module's MirroredConfigSetRequest (migrated to the new API; kept a getRawContentStreams() accessor for the Kafka serializer, which needs the raw per-stream bytes/metadata directly).

Scope note, not fully covered by the ticket title: ContentStream itself cannot be removed -- it's also the server-read-side contract (SolrQueryRequest#getContentStreams(), ~50 files in solr/core), which ContentWriter has no read-side equivalent for. This PR only removes it from the client write path. Flagging explicitly since my first comment on this ticket mentioned this in passing rather than as its own question -- worth confirming this is the intended scope.

All 3 places that read a ContentStreamUpdateRequest's raw streams directly (bypassing the RequestWriter dispatch) were updated to handle both the single- and multi-part case: EmbeddedSolrServer (in-process client), and the cross-dc module's serializer/test.

Full repo compileTestJava/spotlessJavaCheck/ecjLint/forbiddenApis clean. New end-to-end multipart test passes; ran the affected suites (HttpJettySolrClientTest, HttpJdkSolrClientTest, TestConfigSetsAPI, MirroringConfigSetsHandlerTest, EmbeddedSolrNoSerializeTest, WrappedSolrRequestTest) -- all green.

AI-assisted (Claude Sonnet 5)

Adds MultipartContentWriter/NamedPart to RequestWriter so a request with
several named parts can go through getContentWriter() instead of the
deprecated getContentStreams() fallback -- HttpJettySolrClient builds a real
multipart/form-data body from it (verified end-to-end against a real Jetty
server); HttpJdkSolrClient keeps rejecting multipart, as before.

ContentStream itself stays: it's still the server-read-side contract
(SolrQueryRequest#getContentStreams, ~50 core files), which ContentWriter
has no equivalent for.
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