muralibasani commented on code in PR #23895:
URL: https://github.com/apache/kafka/pull/23895#discussion_r4424549777
##########
server/src/test/java/org/apache/kafka/server/EligibleLeaderReplicasIntegrationTest.java:
##########
@@ -353,13 +355,48 @@ public void
testLastKnownLeaderShouldBeElectedIfEmptyElr() throws ExecutionExcep
}
}
+ @ClusterTest(types = {Type.KRAFT}, metadataVersion =
MetadataVersion.IBP_4_0_IV1)
+ public void testElrUsesReplicationFactorOfTargetPartition() throws
Exception {
+ try (var admin = clusterInstance.admin()) {
+ String testTopicName =
"testElrUsesReplicationFactorOfTargetPartition";
+ admin.updateFeatures(
+ Map.of(EligibleLeaderReplicasVersion.FEATURE_NAME,
+ new
FeatureUpdate(EligibleLeaderReplicasVersion.ELRV_1.featureLevel(),
FeatureUpdate.UpgradeType.UPGRADE))).all().get();
+ clusterInstance.createTopicWithAssignment(testTopicName, Map.of(
+ 0, List.of(4, 0, 1, 2),
+ 1, List.of(0, 1, 2, 3)));
+
+ // Decrease the replication factor of partition 0 only.
+ admin.alterPartitionReassignments(Map.of(new
TopicPartition(testTopicName, 0),
+ Optional.of(new
NewPartitionReassignment(List.of(4))))).all().get();
+ TestUtils.waitForCondition(() ->
admin.listPartitionReassignments().reassignments().get().isEmpty() &&
+ partition(admin, testTopicName, 0).replicas().size() == 1,
+ "Timed out waiting for the reassignment of partition 0");
+
+ ConfigResource configResource = new
ConfigResource(ConfigResource.Type.TOPIC, testTopicName);
+ admin.incrementalAlterConfigs(Map.of(configResource, List.of(new
AlterConfigOp(
+ new ConfigEntry(TopicConfig.MIN_IN_SYNC_REPLICAS_CONFIG, "3"),
AlterConfigOp.OpType.SET)))).all().get();
Review Comment:
min isr is set to 3 here after the reassignment is done at line 367 above.
During that reassignment, isr is still 1. This can't make any scenarios to show
up. May be move this isr=3 step to before the assignment step.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]