[ 
https://issues.apache.org/jira/browse/SOLR-16355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584418#comment-17584418
 ] 

Shawn Heisey commented on SOLR-16355:
-------------------------------------

I found that if I make the optimize request with SolrJ, it works.  Here is the 
SolrJ code

 
{code:java}
    public static void main(String[] args) throws SolrServerException, 
IOException {
        HttpSolrClient.Builder builder = new 
HttpSolrClient.Builder("https://REDACTED/solr";);
        HttpSolrClient solrClient = builder.build();
        String collection = "dovecot";
        UpdateRequest req2 = new UpdateRequest();
        req2.setAction(ACTION.OPTIMIZE, true, true);
        req2.setAction(ACTION.COMMIT, true, true);
        req2.process(solrClient, collection);
    }
{code}

This is what was logged for that SolrJ request:

 

 
{code:java}
2022-08-24 18:12:59.560 INFO  (qtp1165791284-124) [dovecot shard1 core_node2 
dovecot_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory webapp=/solr 
path=/update 
params={optimize=true&maxSegments=1&waitSearcher=true&commit=true&softCommit=false&wt=javabin&version=2}{optimize=}
 0 52846{code}
This is what is logged with the curl request:

 

 
{code:java}
2022-08-24 14:42:45.955 INFO  (qtp1165791284-130) [dovecot shard1 core_node2 
dovecot_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessor
Factory webapp=/solr path=/update params={optimize=true&commit=true}{optimize=} 
0 58{code}
If I change the curl command to the following (matching what was logged with 
the SolrJ request) then it works:
{code:java}
curl -v 
"http://localhost:8983/solr/dovecot/update?optimize=true&maxSegments=1&waitSearcher=true&commit=true&softCommit=false"{code}
 

I will try some other combinations of params to see which it needs.

> When there are no changes to commit, an optimize is skipped
> -----------------------------------------------------------
>
>                 Key: SOLR-16355
>                 URL: https://issues.apache.org/jira/browse/SOLR-16355
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 9.0, 8.11
>            Reporter: Shawn Heisey
>            Priority: Major
>
> I had been trying to run an optimize on my index.  Every time I tried it, the 
> request completed instantly and did not do the optimize.
> If I request an optimize while a reindex is underway, so there are 
> uncommitted changes, then it does actually do the optimize.  The index is 
> very small so it only takes a few seconds.
> It looks to me like whatever logic the update handler has which causes a 
> commit to be a no-op when there are no changes to commit is also causing the 
> optimize to be a no-op.
> This is the request I am making:
> {code:java}
> curl -v 
> "http://localhost:8983/solr/dovecot/update?commit=true&optimize=true"{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to