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

KAFKA-8969 Log the partition being made online due to unclean leader election. #7440

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

smccauliff
Copy link
Contributor

Minor refactor to PartitionLeaderElectionAlgorithms and Election to move side effects outside of PartitionLeaderElectionAlgorithms and into higher level Election.

Added a unit test to the PartitionStateMachine to verify that unclean leader election correctly assigns a partition and increments the ule metric.

@ijuma
Copy link
Contributor

ijuma commented Oct 7, 2019

cc @jsancio

Copy link
Member

@jsancio jsancio left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @smccauliff. Just a few minor suggestions.

}
} else {
None
}
Copy link
Member

Choose a reason for hiding this comment

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

This formatting doesn't seem correct. How about:

assignment
  .find(id => liveReplicas.contains(id) && isr.contains(id))
  .map((_, false)) // or .map(_ -> false) or .map(id => (id, false))
  .orElse {
    if (uncleanLeaderElectionEnabled) {
      assignment.find(liveReplicas.contains).map((_, true))
    else {
      None
    }
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't compile. At least on scala 2.11. The compiler thinks the type for the first type parameter of the tuple is Any or something else.

core/src/main/scala/kafka/controller/Election.scala Outdated Show resolved Hide resolved
@jsancio
Copy link
Member

jsancio commented Oct 7, 2019

retest this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants