Skip to content

SOLR-15996: disabling PerReplicaState was resulting in DOWN replicas#644

Closed
noblepaul wants to merge 2 commits intomainfrom
jira/solr15996
Closed

SOLR-15996: disabling PerReplicaState was resulting in DOWN replicas#644
noblepaul wants to merge 2 commits intomainfrom
jira/solr15996

Conversation

@noblepaul
Copy link
Contributor

No description provided.

Copy link
Contributor

@madrob madrob left a comment

Choose a reason for hiding this comment

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

Please add a unit test.

import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

please configure your editor to not do this

Copy link
Contributor

Choose a reason for hiding this comment

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

This is becoming a huge problem. I'm new to IntelliJ, and it seems to be doing this to all my PRs too. When I used Eclipse, this wasn't possible. Can we somehow add this configuration to the "gradlew idea" task?

Copy link
Contributor

Choose a reason for hiding this comment

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

I never run the idea task, IntelliJ seems to be able to import the gradle project natively for me. Occasionally I have to "restart and invalidate caches" to reimport it, but that's usually after I've been changing branches around a lot.

I couldn't find a checked in or shared IntelliJ settings file, although I feel like it used to exist?

Under the settings, Editor > Code Style > Java find the tab called imports and I have class count set to 99 and all of the packages to use import with * choices unchecked or deleted.

Comment on lines +58 to +59
@SuppressWarnings({"unchecked"})
Map<String, Replica> replicas = Collections.EMPTY_MAP;
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that was a merge issue

coll.forEachReplica((s, replica) -> {
PerReplicaStates.State prsState = prs.states.get(replica.getName());
if (prsState != null) {
if (prsState.state != replica.getState()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This if statement and the next one look like they are almost doing the same thing, is there a way to simplify this logic so that we are only getting/setting from modifiedSlices once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about it. I thought this would make it simpler. suggestions are welcome

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I don't think I have any better ways.

Comment on lines +119 to +121
if(!enable) {
coll = updateReplicasFromPrs(coll, prs);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there still a race condition here? What happens if a replica goes down (or changes leadership) between the fetch and the persist which happens much later?

}
}
}
class CommandWithClusterState extends ArrayList<ZkWriteCommand> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like bad design. We probably want to have composition over inheritance here, it feels really strange to be extending ArrayList just to give it an extra data field for what we're returning.

}
}

private List<ZkWriteCommand> processMessage(ClusterState clusterState,
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to refactor this away from returning a list and instead return a ZkWriteCommand directly. Most of the operations are singleton commands so that is easy to handle. Then we could create a MultiCommand to handle the cases where that is not enough (looks like just down node, I think?). And the use case you're trying to address would be handled either by double-dispatch pattern or a similar cast to what we have in your PR now.

coll.forEachReplica((s, replica) -> {
PerReplicaStates.State prsState = prs.states.get(replica.getName());
if (prsState != null) {
if (prsState.state != replica.getState()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I don't think I have any better ways.

@github-actions
Copy link

This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the dev@solr.apache.org mailing list. Thank you for your contribution!

@github-actions github-actions bot added the stale PR not updated in 60 days label Feb 22, 2024
@github-actions
Copy link

github-actions bot commented Oct 5, 2024

This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.

@github-actions github-actions bot added the closed-stale Closed after being stale for 60 days label Oct 5, 2024
@github-actions github-actions bot closed this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-stale Closed after being stale for 60 days stale PR not updated in 60 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants