-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-20772 (1/n): Add DLQ system tests for single-partition share group scenarios #22786
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
Merged
+416
−12
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ef51e45
Add DLQ Single Partition Tests
sjhajharia e5927fb
Add combined_kraft mode
sjhajharia be8b985
Address comment
sjhajharia 74361bd
Empty Commit
sjhajharia 4399414
Address comment-1
sjhajharia 29e40d4
Merge remote-tracking branch 'origin/trunk' into KAFKA-20772
sjhajharia 26e2ead
Cleanup unstable flag
sjhajharia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,7 +207,8 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI | |
| dynamicRaftQuorum=False, | ||
| use_transactions_v2=False, | ||
| use_streams_groups=False, | ||
| enable_assignment_batching=None | ||
| enable_assignment_batching=None, | ||
| share_version=None | ||
| ): | ||
| """ | ||
| :param context: test context | ||
|
|
@@ -273,6 +274,7 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI | |
| :param use_transactions_v2: When true, uses transaction.version=2 which utilizes the new transaction protocol introduced in KIP-890 | ||
| :param use_streams_groups: When true, enables the use of streams groups introduced in KIP-1071 | ||
| :param enable_assignment_batching: When true, enables assignment batching introduced in KIP-1263. If not specified, defaults to True. | ||
| :param share_version: When set, bootstraps the cluster with --feature share.version=<value> (KIP-932/KIP-1191). | ||
| """ | ||
|
|
||
| self.zk = zk | ||
|
|
@@ -288,6 +290,7 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI | |
|
|
||
| self.use_transactions_v2 = use_transactions_v2 | ||
| self.use_streams_groups = use_streams_groups | ||
| self.share_version = share_version | ||
|
|
||
| # Set consumer_group_migration_policy based on context and arguments. | ||
| if consumer_group_migration_policy is None: | ||
|
|
@@ -361,7 +364,8 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI | |
| server_prop_overrides=server_prop_overrides, dynamicRaftQuorum=self.dynamicRaftQuorum, | ||
| use_transactions_v2=self.use_transactions_v2, | ||
| use_streams_groups=self.use_streams_groups, | ||
| enable_assignment_batching=self.enable_assignment_batching | ||
| enable_assignment_batching=self.enable_assignment_batching, | ||
| share_version=self.share_version | ||
| ) | ||
| self.controller_quorum = self.isolated_controller_quorum | ||
|
|
||
|
|
@@ -786,6 +790,12 @@ def prop_file(self, node): | |
| override_configs[config_property.UNSTABLE_API_VERSIONS_ENABLE] = str(True) | ||
| override_configs[config_property.UNSTABLE_FEATURE_VERSIONS_ENABLE] = str(True) | ||
|
|
||
| if self.share_version is not None and int(self.share_version) > 1: | ||
| # share.version=2 (KIP-1191 DLQ) is above ShareVersion.LATEST_PRODUCTION (SV_1), so both | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ShareVersion.LATEST_PRODUCTION is SV_2 now.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleaned up setting the unstable flag. |
||
| # the storage format tool and the broker need unstable feature versions enabled to | ||
| # accept it -- kafka-storage.sh format reads this same properties file via --config. | ||
| override_configs[config_property.UNSTABLE_FEATURE_VERSIONS_ENABLE] = str(True) | ||
|
|
||
| if self.enable_assignment_batching: | ||
| # Assignment batching is enabled by default in Kafka | ||
| pass | ||
|
|
@@ -907,6 +917,12 @@ def start_node(self, node, timeout_sec=60, **kwargs): | |
| else: | ||
| if get_version(node).supports_feature_command(): | ||
| cmd += " --feature transaction.version=0" | ||
| if self.share_version is not None: | ||
| # share.version=2 (KIP-1191 DLQ) declares a bootstrap metadata.version of 4.4-IV0, | ||
| # but that isn't yet a valid --release-version for kafka-storage.sh format in this | ||
| # build (max supported is 4.3-IV0), and Feature.validateVersion() does not enforce | ||
| # the dependency, so the feature can be bootstrapped on its own. | ||
| cmd += " --feature share.version=%s" % self.share_version | ||
|
sjhajharia marked this conversation as resolved.
|
||
| self.logger.info("Running log directory format command...\n%s" % cmd) | ||
| node.account.ssh(cmd) | ||
|
|
||
|
|
@@ -1748,6 +1764,57 @@ def set_share_group_offset_reset_strategy(self, group, strategy=None, node=None, | |
| command_config) | ||
| return "Completed" in self.run_cli_tool(node, cmd) | ||
|
|
||
| def set_share_group_dlq_config(self, group, topic_name=None, copy_record_enable=None, node=None, command_config=None): | ||
| """ Set the DLQ configs (errors.deadletterqueue.topic.name / errors.deadletterqueue.copy.record.enable) | ||
| for the given share group (KIP-1191). | ||
| """ | ||
| if topic_name is None and copy_record_enable is None: | ||
| return | ||
| if node is None: | ||
| node = self.nodes[0] | ||
| config_script = self.path.script("kafka-configs.sh", node) | ||
|
|
||
| if command_config is None: | ||
| command_config = "" | ||
| else: | ||
| command_config = "--command-config " + command_config | ||
|
|
||
| configs = [] | ||
| if topic_name is not None: | ||
| configs.append("errors.deadletterqueue.topic.name=%s" % topic_name) | ||
| if copy_record_enable is not None: | ||
| configs.append("errors.deadletterqueue.copy.record.enable=%s" % str(copy_record_enable).lower()) | ||
|
|
||
| cmd = fix_opts_for_new_jvm(node) | ||
| cmd += "%s --bootstrap-server %s --group %s --alter --add-config \"%s\" %s" % \ | ||
| (config_script, | ||
| self.bootstrap_servers(self.security_protocol), | ||
| group, | ||
| ",".join(configs), | ||
| command_config) | ||
| return "Completed" in self.run_cli_tool(node, cmd) | ||
|
|
||
| def set_share_group_delivery_count_limit(self, group, limit, node=None, command_config=None): | ||
| """ Set the share.delivery.count.limit config (GroupConfig, per-group override) for the given share group. | ||
| """ | ||
| if node is None: | ||
| node = self.nodes[0] | ||
| config_script = self.path.script("kafka-configs.sh", node) | ||
|
|
||
| if command_config is None: | ||
| command_config = "" | ||
| else: | ||
| command_config = "--command-config " + command_config | ||
|
|
||
| cmd = fix_opts_for_new_jvm(node) | ||
| cmd += "%s --bootstrap-server %s --group %s --alter --add-config \"share.delivery.count.limit=%s\" %s" % \ | ||
| (config_script, | ||
| self.bootstrap_servers(self.security_protocol), | ||
| group, | ||
| limit, | ||
| command_config) | ||
| return "Completed" in self.run_cli_tool(node, cmd) | ||
|
|
||
| def list_consumer_groups(self, node=None, command_config=None, state=None, type=None): | ||
| """ Get list of consumer groups. | ||
| """ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have stable metadata version that includes SV_2, we should tidy this up somewhat. There's also some tidying needed for streams group enablement I see.