patsonluk opened a new pull request, #1093:
URL: https://github.com/apache/solr/pull/1093

   Copied from 8.8 PR https://github.com/fullstorydev/lucene-solr/pull/173
   
   https://issues.apache.org/jira/browse/SOLR-16446
   
   # Description
   
   It is found that the existing `CreateCollectionCmd` would update the 
[`state.json` per new 
replica](https://github.com/fullstorydev/lucene-solr/blob/fec2ac23fb5068fddf1a2c3d51956128719ec7a5/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java#L281-L282).
 This potentially creates a lot of unnecessary writes as only the last 
state.json with all the replicas matters.
   
   Take note that this actually is a problem for non PRS collection as well, 
but probably less problematic for non PRS as even if it does very similar 
operation per replica by sending the update to OS queue 
`ccc.offerStateUpdate(Utils.toJSON(props));`, at least OS would use the 
`ClusterStateUpdater` which uses `ZkStateWriter#enqueueUpdate` that likely 
batches up state.json update (only writes the latest entry every 2 secs by 
default) ; while for PRS, we use directly update which each call translates to 
an actual call to ZK.
   
   # Solution
   
   We will move the `ZkClient#setData` statement out of the replica loop and 
only call it once outside
   
   # Tests
   
   There is already an integration test 
`PerReplicaStatesIntegrationTest#testZkNodeVersions`, we have updated the count 
to reflect the reduction of `setData` calls
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to 
Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms 
to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [ ] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to