You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Da...@coop.ch on 2024/10/09 13:14:23 UTC

Migration to ConcurrentUpdateHttp2SolrClient

Hey All

Is there a migration Guide for Users coming from using `ConcurrentUpdateSolrClient` who want to upgrade to `ConcurrentUpdateHttp2SolrClient`?

It seems to not be as straightforward as upgrading from `HttpSolrClient` to `Http2SolrClient`.

ConcurrentUpdateSolrClient has a Builder with the fallowing constructor:


public Builder(String baseSolrUrl)

-

But  the Builder in ConcurrentUpdateHttp2SolrClient does require us to give the constructor more parameters.


public Builder(String baseSolrUrl, Http2SolrClient client)

...

public Builder(String baseSolrUrl, Http2SolrClient client, boolean closeHttp2Client)

-

<https://solr.apache.org/docs/9_7_0/solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.Builder.html#%3Cinit%3E(java.lang.String,org.apache.solr.client.solrj.impl.Http2SolrClient)>
ConcurrentUpdateHttp2SolrClient.Builder (Solr 9.7.0 solrj API)<https://solr.apache.org/docs/9_7_0/solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.Builder.html#%3Cinit%3E(java.lang.String,org.apache.solr.client.solrj.impl.Http2SolrClient)>
solr.apache.org<https://solr.apache.org/docs/9_7_0/solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.Builder.html#%3Cinit%3E(java.lang.String,org.apache.solr.client.solrj.impl.Http2SolrClient)>
[favicon.ico]<https://solr.apache.org/docs/9_7_0/solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.Builder.html#%3Cinit%3E(java.lang.String,org.apache.solr.client.solrj.impl.Http2SolrClient)>

The javadoc somehow claims that a constructor similar to the one in the old api exists. But I am pretty sure that this is not the case.


SolrClient client = new ConcurrentUpdateHttp2SolrClient.Builder("http://my-solr-server:8983/solr").build();

-

The javadoc also mixes up the order of the parameters:


SolrClient client = new ConcurrentUpdateHttp2SolrClient.Builder(client, "http://my-solr-server:8983/solr/core1").build();

---

What does the boolean parameter `closeHttp2Client` do? This seems to be missing from the javadoc.

What was the motivation to require the user to create an additional Http2SolrClient, when they were not required to do that with the older api?

With kind Regards

Dario

Re: Migration to ConcurrentUpdateHttp2SolrClient

Posted by Jan Høydahl <ja...@cominvent.com>.
I see the javadoc has been fixed on main but not in 9.x. So I guess you have to first create a Http2SolrClient for yourself and pass it in.

https://github.com/apache/solr/blob/main/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java#L709-L729

Jan

> 9. okt. 2024 kl. 15:14 skrev Dario.Viva@coop.ch:
> 
> Hey All
> 
> Is there a migration Guide for Users coming from using `ConcurrentUpdateSolrClient` who want to upgrade to `ConcurrentUpdateHttp2SolrClient`?
> 
> It seems to not be as straightforward as upgrading from `HttpSolrClient` to `Http2SolrClient`.
> 
> ConcurrentUpdateSolrClient has a Builder with the fallowing constructor:
> 
> public Builder(String baseSolrUrl)
> 
> —
> 
> But  the Builder in ConcurrentUpdateHttp2SolrClient does require us to give the constructor more parameters.
> 
> public Builder(String baseSolrUrl, Http2SolrClient client)
> …
> public Builder(String baseSolrUrl, Http2SolrClient client, boolean closeHttp2Client)
> —
> 
> https://solr.apache.org/docs/9_7_0/solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.Builder.html#%3Cinit%3E(java.lang.String,org.apache.solr.client.solrj.impl.Http2SolrClient)
> 
> The javadoc somehow claims that a constructor similar to the one in the old api exists. But I am pretty sure that this is not the case.
> 
> SolrClient client = new ConcurrentUpdateHttp2SolrClient.Builder("http://my-solr-server:8983/solr").build();
> 
> —
> 
> The javadoc also mixes up the order of the parameters:
> 
> SolrClient client = new ConcurrentUpdateHttp2SolrClient.Builder(client, "http://my-solr-server:8983/solr/core1").build();
> 
> ---
> 
> What does the boolean parameter `closeHttp2Client` do? This seems to be missing from the javadoc.
> 
> What was the motivation to require the user to create an additional Http2SolrClient, when they were not required to do that with the older api?
> 
> With kind Regards
> 
> Dario
> <favicon.ico>