Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-16995: Use leaderEligible property where it makes sense #1981

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

pvcnt
Copy link
Contributor

@pvcnt pvcnt commented Oct 5, 2023

https://issues.apache.org/jira/browse/SOLR-16995

Description

A new leaderEligible property was introduced on the Replica.Type in Solr 9 (?), but it is currently not used much in the codebase. Most of the code still uses something like replicaType == Type.NRT || replicaType == Type.TLOG, which makes the intention behind the code more difficult to read.

Solution

This PR is a refactoring using the leaderEligible property wherever it makes sense, to make the code more readable.

Tests

No new tests, as this refactoring does not introducing any new classes or methods, and does not change the existing behaviour.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute 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 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

@pvcnt
Copy link
Contributor Author

pvcnt commented Oct 5, 2023

Related to #1928 (split this particular change into a separate PR).

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

BTW a JIRA isn't necessary for this low-impact internal refactoring. Just an FYI; since you created it, keep it.

@pvcnt
Copy link
Contributor Author

pvcnt commented Oct 5, 2023

@dsmiley It's actually the same JIRA as #1928. It just split my end goal (making it easier to work with replica types and possibly add new ones) into several PRs.

@pvcnt
Copy link
Contributor Author

pvcnt commented Oct 5, 2023

Failing tests are passing locally, they ma be flappers.

@HoustonPutman
Copy link
Contributor

I love this. To many single-class/enum cases across the codebase, which makes adding new options much harder.

@dsmiley dsmiley merged commit fe72820 into apache:main Oct 12, 2023
3 checks passed
@pvcnt pvcnt deleted the leader-eligible branch October 25, 2023 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants