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-7837: Ensure we do not shrink ISR for offline partitions #6202

Merged
merged 1 commit into from
Jan 26, 2019

Conversation

dhruvilshah3
Copy link
Contributor

@dhruvilshah3 dhruvilshah3 commented Jan 25, 2019

When a partition is marked offline due to a failed disk, the leader is supposed to not shrink its ISR any more. In ReplicaManager#maybeShrinkIsr, we iterate through all non-offline partitions to shrink the ISR. If an ISR needs to shrink, we need to write the new ISR to ZK, which can take a bit of time. In this window, some partitions could now be marked as offline, but may not be picked up by the iterator. This is because the offline partition iterator used in ReplicaManager#maybeShrinkIsr is weakly consistent and does not necessarily reflect the updated offline state.

This patch fixes the above issue by iterating through all topic partitions and checking whether the partition has been made offline within the iteration. This helps ensure we detect a partition being made offline during the iteration and prevent ISRs from shrinking thereof.

@ijuma
Copy link
Contributor

ijuma commented Jan 26, 2019

Thanks for the PR. It's good to include details in the PR description about fixes like this.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dhruvilshah3 : Thanks for the patch. LGTM

@junrao junrao merged commit 646ec94 into apache:trunk Jan 26, 2019
@dhruvilshah3 dhruvilshah3 deleted the shrink-offline-partitions branch January 26, 2019 06:23
asfgit pushed a commit that referenced this pull request Jan 27, 2019
…le when shrinking ISR (#6202)

Check if a partition is offline while iterating all partitions.

Reviewers: Jun Rao <junrao@gmail.com>
(cherry picked from commit 646ec94)
jarekr pushed a commit to confluentinc/kafka that referenced this pull request Apr 18, 2019
* ak/trunk:
  MINOR: Update usage of deprecated API (apache#6146)
  KAFKA-4217: Add KStream.flatTransform (apache#5273)
  MINOR: Update Gradle to 5.1.1 (apache#6160)
  KAFKA-3522: Generalize Segments (apache#6170)
  Added quotes around the class path (apache#4469)
  KAFKA-7837: Ensure offline partitions are picked up as soon as possible when shrinking ISR (apache#6202)
  MINOR: In the MetadataResponse schema, ignorable should be a boolean
  KAFKA-7838: Log leader and follower end offsets when shrinking ISR (apache#6168)
  KAFKA-5692: Change PreferredReplicaLeaderElectionCommand to use Admin… (apache#3848)
  MINOR: clarify why suppress can sometimes drop tombstones (apache#6195)
  MINOR: Upgrade ducktape to 0.7.5 (apache#6197)
  MINOR: Improve IntegrationTestUtils documentation (apache#5664)
  MINOR: upgrade to jdk8 8u202
  KAFKA-7693; Fix SequenceNumber overflow in producer (apache#5989)
  KAFKA-7692; Fix ProducerStateManager SequenceNumber overflow (apache#5990)
  MINOR: update copyright year in the NOTICE file. (apache#6196)
  KAFKA-7793: Improve the Trogdor command line. (apache#6133)
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…le when shrinking ISR (apache#6202)

Check if a partition is offline while iterating all partitions.

Reviewers: Jun Rao <junrao@gmail.com>
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.

3 participants