Skip to content

KAFKA-14511: extend AlterIncrementalConfigs API to support group config#15067

Merged
dajac merged 22 commits intoapache:trunkfrom
DL1231:KAFKA-14511
Aug 12, 2024
Merged

KAFKA-14511: extend AlterIncrementalConfigs API to support group config#15067
dajac merged 22 commits intoapache:trunkfrom
DL1231:KAFKA-14511

Conversation

@DL1231
Copy link
Copy Markdown
Collaborator

@DL1231 DL1231 commented Dec 24, 2023

This PR add resources to store and handle consumer group config. jira

Changes include:

  • Adding GRUOP to resource type
  • Corresponding DYNAMIC consumer group configurations in resources.
  • Changes to support dynamic loading of configuration on changes.
  • Test cases for the changes

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@dajac dajac added the KIP-848 The Next Generation of the Consumer Rebalance Protocol label Dec 24, 2023
Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

KIP-848 introduces the new GROUP resource type with the intent that it will be used for more than just consumer groups in the future.

Comment thread clients/src/main/java/org/apache/kafka/clients/admin/ConfigEntry.java Outdated
Comment thread core/src/main/scala/kafka/server/BrokerServer.scala Outdated
Comment thread core/src/main/scala/kafka/server/ConfigHandler.scala Outdated
Comment thread core/src/main/scala/kafka/server/ControllerConfigurationValidator.scala Outdated
Comment thread core/src/main/scala/kafka/server/metadata/DynamicConfigPublisher.scala Outdated
# Conflicts:
#	core/src/main/scala/kafka/zk/AdminZkClient.scala
#	core/src/test/scala/unit/kafka/server/KafkaApisTest.scala
@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jan 10, 2024

@AndrewJSchofield, I've updated the PR. Please take a look again. Thanks.

Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

This PR is looking pretty good now. Thanks.

Comment thread clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java Outdated
Comment thread core/src/main/scala/kafka/server/ConfigHandler.scala
# Conflicts:
#	core/src/main/scala/kafka/server/KafkaConfig.scala
@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jan 14, 2024

Thanks @AndrewJSchofield for the feedback, I have addressed comments.

Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

lgtm

@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jan 17, 2024

@dajac, PTAL, thanks in advance.

# Conflicts:
#	core/src/main/scala/kafka/server/BrokerServer.scala
#	core/src/main/scala/kafka/server/KafkaConfig.scala
#	group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java
#	group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java
@github-actions
Copy link
Copy Markdown

This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch)

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions Bot added the stale Stale PRs label May 21, 2024
@AndrewJSchofield
Copy link
Copy Markdown
Member

@DL1231 I'm interested in getting group configs working. This PR is quite out of date, in particular because there's been a lot of refactoring of configs in Kafka recently. Would you like to rebase it and get it working again? Alternatively, I'm happy to take the work on instead.

@github-actions github-actions Bot removed the stale Stale PRs label Jun 7, 2024
# Conflicts:
#	core/src/main/scala/kafka/security/authorizer/AclEntry.scala
#	core/src/main/scala/kafka/server/BrokerServer.scala
#	core/src/main/scala/kafka/server/ConfigHandler.scala
#	core/src/main/scala/kafka/server/KafkaConfig.scala
#	core/src/test/scala/unit/kafka/admin/ConfigCommandTest.scala
#	core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala
#	group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java
#	group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorShard.java
#	group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java
#	group-coordinator/src/main/java/org/apache/kafka/coordinator/group/runtime/CoordinatorRuntime.java
#	group-coordinator/src/test/java/org/apache/kafka/coordinator/group/runtime/CoordinatorRuntimeTest.java
@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jun 15, 2024

@AndrewJSchofield I've resolved the conflict, PTAL, thanks in advance.

@DL1231 DL1231 force-pushed the KAFKA-14511 branch 2 times, most recently from 0657ace to ab95c05 Compare June 15, 2024 07:36
@AndrewJSchofield
Copy link
Copy Markdown
Member

@DL1231 Yes, I'll give the updated code a detailed review in the next few days. Thanks for rebasing it.

Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield 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 updated PR. I left a few comments.

Comment thread core/src/main/scala/kafka/server/KafkaApis.scala
DL1231 added 2 commits June 20, 2024 10:00
# Conflicts:
#	core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala
@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jun 20, 2024

@AndrewJSchofield I've updated the PR. Please take a look again. Thanks.

Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks for the PR.

Copy link
Copy Markdown
Contributor

@omkreddy omkreddy left a comment

Choose a reason for hiding this comment

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

@DL1231 Thanks for the PR. changes LGTM.

will wait for @dajac review

Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

@DL1231 Thanks for the update. I just made another pass on the patch and I left some comments for consideration.

Comment thread core/src/test/scala/unit/kafka/server/ConsumerGroupHeartbeatRequestTest.scala Outdated
Comment thread core/src/test/scala/unit/kafka/server/ConsumerGroupHeartbeatRequestTest.scala Outdated

@ParameterizedTest
@ValueSource(strings = Array("kraft+kip848"))
def testIncrementalAlterDefaultGroupConfig(quorum: String): Unit = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: testDynamicGroupConfigChangeWithInvalidValue?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Consider aligning with testIncrementalAlterDefaultTopicConfig

val resource = new ConfigResource(ConfigResource.Type.GROUP, "")
val op = new AlterConfigOp(new ConfigEntry(GroupConfig.CONSUMER_SESSION_TIMEOUT_MS_CONFIG, "200000"), OpType.SET)
val future = admin.incrementalAlterConfigs(Map(resource -> List(op).asJavaCollection).asJava).all
TestUtils.assertFutureExceptionTypeEquals(future, classOf[InvalidRequestException])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if it should rather be a InvalidConfigurationException exception. What's the reasoning for using InvalidRequestException?

Copy link
Copy Markdown
Collaborator Author

@DL1231 DL1231 Jul 7, 2024

Choose a reason for hiding this comment

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

Consider aligning with testIncrementalAlterDefaultTopicConfig

super(CONFIG, props, false);
}

public static Set<String> configNames() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

configNames is only used in validateNames. Should we remove it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is also used in testFromPropsInvalid.

# Conflicts:
#	core/src/test/scala/unit/kafka/server/ConsumerGroupHeartbeatRequestTest.scala
@dajac
Copy link
Copy Markdown
Member

dajac commented Jul 5, 2024

I'll be away until 7/29. I will continue reviewing this PR when I come back.

@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Jul 7, 2024

@dajac Sorry for the delay, I've updated the PR, PTAL when you get a chance.

DL1231 added 2 commits July 30, 2024 19:44
# Conflicts:
#	group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java
#	group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTestContext.java
@DL1231 DL1231 requested a review from dajac July 30, 2024 12:25
@dajac
Copy link
Copy Markdown
Member

dajac commented Jul 30, 2024

@DL1231 I am back. Thanks for the update. I will review your PR asap.

Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

@DL1231 Thanks for the update and please excuse me for the delay on this one. I went thought it again and left a few minor comments. I think that we can merge it when they are addressed.

CLIENT_METRICS((byte) 16),
BROKER_LOGGER((byte) 8),
BROKER((byte) 4),
GROUP((byte) 3),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I disagree with this change. I think that GROUP should use 32 in order to stay consistent with the existing values.

}

/**
* Create a group config instance using the given properties and defaults
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Let's add a . at the end of the sentence for consistency.

Comment on lines +1122 to +1130
/**
* Copy the subset of properties that are relevant to consumer group.
*/
def extractGroupConfigMap: java.util.Map[String, Int] = {
val groupProps = new java.util.HashMap[String, Int]()
groupProps.put(GroupConfig.CONSUMER_SESSION_TIMEOUT_MS_CONFIG, groupCoordinatorConfig.consumerGroupSessionTimeoutMs)
groupProps.put(GroupConfig.CONSUMER_HEARTBEAT_INTERVAL_MS_CONFIG, groupCoordinatorConfig.consumerGroupHeartbeatIntervalMs)
groupProps
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to move this method to GroupCoordinatorConfig? GroupCoordinatorConfig has changed quite a lot since this PR was started. It seems to me that keeping all the group related logic there would make sense. What do you think?

If we do this, we could also simplify GroupConfigManager.validate.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes it makes sense to me. Moved this method to GroupCoordinatorConfig.

# Conflicts:
#	core/src/main/scala/kafka/server/BrokerServer.scala
#	core/src/test/scala/unit/kafka/server/ControllerConfigurationValidatorTest.scala
@DL1231
Copy link
Copy Markdown
Collaborator Author

DL1231 commented Aug 8, 2024

Hi @dajac. Thanks a lot for the review. I have made the required changes in the last commit, PTAL when you get a chance.

@DL1231 DL1231 force-pushed the KAFKA-14511 branch 5 times, most recently from 767e756 to 10b9d24 Compare August 9, 2024 07:50
Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the patch, @DL1231! I will merge it when the build completes.

@dajac
Copy link
Copy Markdown
Member

dajac commented Aug 9, 2024

I spoke too quickly. @DL1231 There are related failed tests. For instance:

  • testInvalidProps() – org.apache.kafka.coordinator.group.GroupConfigTest
    Could you please check?

@dajac
Copy link
Copy Markdown
Member

dajac commented Aug 9, 2024

@DL1231 The last build failed with compilation errors. Could you please check? I would also advice to not rebase and force-push from now on. It will be easier for me to follow the fixes. Otherwise, I have to go through the entire PR.

@dajac dajac merged commit bbdf79e into apache:trunk Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

KIP-848 The Next Generation of the Consumer Rebalance Protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants