You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "patsonluk (via GitHub)" <gi...@apache.org> on 2023/07/04 22:44:30 UTC
[GitHub] [solr] patsonluk opened a new pull request, #1752: SOLR-16860: Remove watch from ZkStateReader of Coordinator Node when collection is deleted
patsonluk opened a new pull request, #1752:
URL: https://github.com/apache/solr/pull/1752
https://issues.apache.org/jira/browse/SOLR-16860
# Description
It's found that DocCollection watch is not removed from `ZkStateReader` of Coordinator node if such collection is deleted.
Core registration in CoordinatorHttpCall correctly registers watch in ZkStateReader as in https://github.com/apache/solr/blob/f774922ecf44b18b78435cef8735618bb793ac30/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java#L99, however there’s no code to remove such watch on collection deletion (state update).
For non coordinator node, it’s done at UnloadCoreOnDeleteWatcher at https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/cloud/ZkController.java#L2869
# Solution
Use `ZkStateReader#registerDocCollectionWatcher` instead of `ZkStateReader#registerCore`, the `stateWatcher` should return `true` if the collection is removed, hence trigger removal of such watch from the internal map of `ZkStateReader`
Take note that such replacement is fine as:
1. We do not need the CollectionWatch.coreRefCount as for coordinator each collection should invoke registerDocCollectionWatcher at most once
2. Similar to registerCore, StateWatcher#refreshAndWatch should be invoked in registerDocCollectionWatcher as well
# Tests
Added test case `testWatch` in `TestCoordinatorRole`, which fails before such fix but succeeds when fix is applied
# Checklist
Please review the following and check all that apply:
- [x] 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.
- [x] 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)
- [x] I have developed this patch against the `main` branch.
- [ ] I have run `./gradlew check`.
- [x] 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-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] noblepaul merged pull request #1752: SOLR-16860: Remove watch from ZkStateReader of Coordinator Node when collection is deleted
Posted by "noblepaul (via GitHub)" <gi...@apache.org>.
noblepaul merged PR #1752:
URL: https://github.com/apache/solr/pull/1752
--
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-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org