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

Ivan Saric commented on SOLR-18612:
-----------------------------------

[~dsmiley] a question on the last group of solr/core sites, left out of #5336 
and #5365 on purpose: the Overseer {{results}} list and the wrappers around it 
({{OverseerTaskProcessor}} lock-failure response, 
{{DistributedApiAsyncTracker}} crash response, 
{{OverseerConfigSetMessageHandler}}, 
{{DistributedCollectionConfigSetCommandRunner}}, the async-submit echo in 
{{CollectionsHandler}}, the snapshot commands' per-shard results).

The wrappers all have unique keys, but 
{{OverseerCollectionMessageHandler.processMessage}}'s {{results}} cannot be a 
{{SimpleOrderedMap}} as is: {{DeleteShardCmd}} adds {{success}} once per 
deleted replica and {{failure}} once per failed one, and {{DeleteReplicaCmd}} 
adds a {{failure}} string per failed replica. {{CreateShardCmd}} and 
{{CollectionHandlingUtils.addSuccess/addFailure}} already merge into a single 
{{success}}/{{failure}} map keyed by node/core. Since the wrappers and 
{{results}} land in the same place in REQUESTSTATUS and in synchronous 
responses ({{rsp.getValues().addAll(overseerResponse.getResponse())}}), 
converting only the wrappers would make the response shape depend on which path 
produced it.

Two ways forward:
# Make the two producers go through {{addSuccess}}/{{addFailure}} so 
{{success}}/{{failure}} appear once as maps, then convert {{results}} and all 
wrappers together in one slice. User-visible for DELETESHARD/DELETEREPLICA with 
several replicas: repeated {{success}} entries become one {{success}} object 
keyed by core, documented like the other sections in the Solr 11 upgrade notes.
# Leave the whole family as {{NamedList}} and note it in the upgrade notes as 
intentionally unchanged.

I lean to 1 as a separate PR after #5336 and #5365, since it changes behavior 
on its own. Which do you prefer?

> Instantiate SimpleOrderedMap instead of NamedList where keys do not repeat 
> (SIP-22 step 5)
> ------------------------------------------------------------------------------------------
>
>                 Key: SOLR-18612
>                 URL: https://issues.apache.org/jira/browse/SOLR-18612
>             Project: Solr
>          Issue Type: Improvement
>          Components: search, SolrJ
>            Reporter: Ivan Saric
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: main(11.0)
>
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> This is step 5 of [SIP-22: NamedList 
> Reduction|https://cwiki.apache.org/confluence/spaces/SOLR/pages/340036504/SIP-22+NamedList+Reduction]:
> {quote}Change NamedList instantiations to SimpleOrderedMap as appropriate; 
> probably many places. This is Solr 10 only; it can affect backwards 
> compatibility. One Jira & PR(s); don't combine with anything else.{quote}
> Step 4 (SOLR-18603) seals the hierarchy. As agreed on the dev list 
> ([Follow-up work after 
> SOLR-17600|https://lists.apache.org/thread/2o09q8yjmsx4l9b58mqqk5mgdbv7qf36]),
>  "Solr 10" now means Solr 11 ({{main}}).
> h3. Scope
> * Instantiation sites only: {{new NamedList(...)}} becomes {{new 
> SimpleOrderedMap(...)}} where the keys provably never repeat. On {{main}} 
> today there are 217 such sites in main sources (75 files in {{solr/core}}, 13 
> in {{solr/solrj}}, 7 across {{solrj-streaming}}, {{test-framework}}, 
> {{benchmark}} and {{solr/modules/*}}).
> * No public method signature changes (NamedList stays in signatures; that is 
> SIP-22 step 7).
> * Tests are out of scope for the first pass (268 further sites in test 
> sources).
> * Sites that rely on repeated keys stay {{NamedList}}: e.g. {{json.nl}} 
> handling, facet structures, {{lst}} config parsing. Where that is not obvious 
> from the code, the PR says why.
> * Excluded: {{SolrQueryResponse}} and the response header, which SOLR-18398 
> migrates to {{LinkedHashMap}} closer to the 11.0 release.
> h3. Compatibility
> * JSON: {{JSONWriter}} writes a {{SimpleOrderedMap}} as a JSON object 
> regardless of {{json.nl}}, while a {{NamedList}} follows {{json.nl}} (default 
> {{flat}}). So changing a NamedList that reaches a response changes that part 
> of the JSON output for clients not using {{json.nl=map}}. Such sites are 
> handled deliberately and listed in the upgrade notes; this is the 
> compatibility impact the SIP anticipates for this step.
> * javabin: a {{SimpleOrderedMap}} is written with its own tag and decoded by 
> SolrJ as a {{SimpleOrderedMap}}, which is still a {{NamedList}}, so existing 
> SolrJ casts keep working. Note that {{solr.solrj.javabin.readMapAsNamedList}} 
> (SOLR-17635) still defaults to {{false}} on {{main}}.
> * Java serialization: SOLR-18196 reported {{ObjectOutputStream}} problems 
> once {{SimpleOrderedMap}} implemented {{Map}}; tests were added in 10.1, the 
> ticket is still open. More SimpleOrderedMap instances widen what that affects.
> h3. Deliverable
> One Jira, several PRs split by module so each is independently reviewable, as 
> with SOLR-17600: {{solr/solrj}} first (smallest, most visible to clients), 
> then {{solr/core}} (possibly split by package), then the remaining modules. 
> Each PR carries its own changelog entry under this key, and the upgrade note 
> is extended as JSON-visible sites are changed.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to