-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-9868: Reduce transaction log partitions for embed broker #8522
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
Merged
Changes from all commits
Commits
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 |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ public EmbeddedKafkaCluster(final int numBrokers, | |
| /** | ||
| * Creates and starts a Kafka cluster. | ||
| */ | ||
| public void start() throws IOException, InterruptedException { | ||
| public void start() throws IOException { | ||
| log.debug("Initiating embedded Kafka cluster startup"); | ||
| log.debug("Starting a ZooKeeper instance"); | ||
| zookeeper = new EmbeddedZookeeper(); | ||
|
|
@@ -98,6 +98,7 @@ public void start() throws IOException, InterruptedException { | |
| putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.GroupInitialRebalanceDelayMsProp(), 0); | ||
| putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.OffsetsTopicReplicationFactorProp(), (short) 1); | ||
| putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.OffsetsTopicPartitionsProp(), 5); | ||
| putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.TransactionsTopicPartitionsProp(), 5); | ||
|
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. This is the actual fix, other parts are just side cleanups. |
||
| putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), true); | ||
|
|
||
| for (int i = 0; i < brokers.length; i++) { | ||
|
|
@@ -241,16 +242,6 @@ public void deleteTopicAndWait(final String topic) throws InterruptedException { | |
| deleteTopicsAndWait(TOPIC_DELETION_TIMEOUT, topic); | ||
| } | ||
|
|
||
| /** | ||
| * Deletes a topic and blocks until the topic got deleted. | ||
| * | ||
| * @param timeoutMs the max time to wait for the topic to be deleted (does not block if {@code <= 0}) | ||
| * @param topic the name of the topic | ||
| */ | ||
| public void deleteTopicAndWait(final long timeoutMs, final String topic) throws InterruptedException { | ||
| deleteTopicsAndWait(timeoutMs, topic); | ||
| } | ||
|
|
||
| /** | ||
| * Deletes multiple topics returns immediately. | ||
| * | ||
|
|
@@ -279,7 +270,7 @@ public void deleteTopicsAndWait(final long timeoutMs, final String... topics) th | |
| for (final String topic : topics) { | ||
| try { | ||
| brokers[0].deleteTopic(topic); | ||
| } catch (final UnknownTopicOrPartitionException e) { } | ||
| } catch (final UnknownTopicOrPartitionException ignored) { } | ||
| } | ||
|
|
||
| if (timeoutMs > 0) { | ||
|
|
@@ -298,24 +289,14 @@ public void deleteAllTopicsAndWait(final long timeoutMs) throws InterruptedExcep | |
| for (final String topic : topics) { | ||
| try { | ||
| brokers[0].deleteTopic(topic); | ||
| } catch (final UnknownTopicOrPartitionException e) { } | ||
| } catch (final UnknownTopicOrPartitionException ignored) { } | ||
| } | ||
|
|
||
| if (timeoutMs > 0) { | ||
| TestUtils.waitForCondition(new TopicsDeletedCondition(topics), timeoutMs, "Topics not deleted after " + timeoutMs + " milli seconds."); | ||
| } | ||
| } | ||
|
|
||
| public void deleteAndRecreateTopics(final String... topics) throws InterruptedException { | ||
| deleteTopicsAndWait(TOPIC_DELETION_TIMEOUT, topics); | ||
| createTopics(topics); | ||
| } | ||
|
|
||
| public void deleteAndRecreateTopics(final long timeoutMs, final String... topics) throws InterruptedException { | ||
| deleteTopicsAndWait(timeoutMs, topics); | ||
| createTopics(topics); | ||
| } | ||
|
|
||
| public void waitForRemainingTopics(final long timeoutMs, final String... topics) throws InterruptedException { | ||
| TestUtils.waitForCondition(new TopicsRemainingCondition(topics), timeoutMs, "Topics are not expected after " + timeoutMs + " milli seconds."); | ||
| } | ||
|
|
||
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.
If we would have written
throws Exceptionfrom the beginning on, this change would not be necessary... (Just to back up my preferred coding stile to only usethrows Exceptionin tests.)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.
Lol, makes sense.