-
Notifications
You must be signed in to change notification settings - Fork 217
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
SKYEDEN-3271 | consumer group cleanup #1933
Merged
szczygiel-m
merged 22 commits into
master
from
SKYEDEN-3271-KafkaConumerGroupDeletion-V2
Jan 8, 2025
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e57248b
SKYEDEN-3271 | consumer group cleanup
MarcinBobinski 3246fd7
SKYEDEN-3271 | lint
MarcinBobinski ac4a550
Merge remote-tracking branch 'origin/master' into SKYEDEN-3271-KafkaC…
MarcinBobinski f308826
SKYEDEN-3271 | tests
MarcinBobinski e6039cf
SKYEDEN-3271 | remove println
MarcinBobinski 93f92b6
SKYEDEN-3271 | refactor + lint
MarcinBobinski 380a992
SKYEDEN-3271 | integration tests
MarcinBobinski 1350b25
SKYEDEN-3271 | lint
MarcinBobinski 9a54adf
SKYEDEN-3271 | remove consumerGroupDeletionTasks after expiration
MarcinBobinski 9fad1ad
SKYEDEN-3271 | added TODOs
MarcinBobinski e58a279
SKYEDEN-3271 | Management Leader
MarcinBobinski 664e6ef
Merge branch 'master' into SKYEDEN-3271-KafkaConumerGroupDeletion-V2
MarcinBobinski 13889a4
Merge remote-tracking branch 'origin/master' into SKYEDEN-3271-KafkaC…
MarcinBobinski 0864abd
SKYEDEN-3271 | changes related to PR
MarcinBobinski 8bdc29e
Merge remote-tracking branch 'origin/SKYEDEN-3271-KafkaConumerGroupDe…
MarcinBobinski 6391fbb
SKYEDEN-3271 | changes related to PR
MarcinBobinski 9f97071
Merge remote-tracking branch 'origin/master' into SKYEDEN-3271-KafkaC…
MarcinBobinski 45259d0
Merge branch 'master' into SKYEDEN-3271-KafkaConumerGroupDeletion-V2
MarcinBobinski 8c280bf
Merge branch 'master' into SKYEDEN-3271-KafkaConumerGroupDeletion-V2
MarcinBobinski 3e3b4ec
SKYEDEN-3271 | Changes related to CR
MarcinBobinski effb792
Merge branch 'master' into SKYEDEN-3271-KafkaConumerGroupDeletion-V2
MarcinBobinski 71964ce
Merge branch 'master' into SKYEDEN-3271-KafkaConumerGroupDeletion-V2
szczygiel-m 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 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
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
...ent/config/SubscriptionConfiguration.java → ...bscription/SubscriptionConfiguration.java
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../config/SubscriptionHealthProperties.java → ...ription/SubscriptionHealthProperties.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...gement/config/SubscriptionProperties.java → .../subscription/SubscriptionProperties.java
This file contains 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
36 changes: 36 additions & 0 deletions
36
.../tech/hermes/management/config/subscription/consumergroup/ConsumerGroupCleanUpConfig.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package pl.allegro.tech.hermes.management.config.subscription.consumergroup; | ||
|
||
import java.time.Clock; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import pl.allegro.tech.hermes.management.domain.subscription.SubscriptionService; | ||
import pl.allegro.tech.hermes.management.domain.subscription.consumergroup.ConsumerGroupCleanUpScheduler; | ||
import pl.allegro.tech.hermes.management.domain.subscription.consumergroup.ConsumerGroupToDeleteRepository; | ||
import pl.allegro.tech.hermes.management.infrastructure.kafka.MultiDCAwareService; | ||
import pl.allegro.tech.hermes.management.infrastructure.leader.ManagementLeadership; | ||
import pl.allegro.tech.hermes.management.infrastructure.zookeeper.ZookeeperRepositoryManager; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(ConsumerGroupCleanUpProperties.class) | ||
public class ConsumerGroupCleanUpConfig { | ||
|
||
@Autowired ZookeeperRepositoryManager zookeeperRepositoryManager; | ||
|
||
@Bean | ||
ConsumerGroupCleanUpScheduler consumerGroupCleanUpScheduler( | ||
MultiDCAwareService multiDCAwareService, | ||
SubscriptionService subscriptionService, | ||
ConsumerGroupCleanUpProperties properties, | ||
ManagementLeadership managementLeadership, | ||
Clock clock) { | ||
return new ConsumerGroupCleanUpScheduler( | ||
multiDCAwareService, | ||
zookeeperRepositoryManager.getRepositoriesByType(ConsumerGroupToDeleteRepository.class), | ||
subscriptionService, | ||
properties, | ||
managementLeadership, | ||
clock); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...h/hermes/management/config/subscription/consumergroup/ConsumerGroupCleanUpProperties.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package pl.allegro.tech.hermes.management.config.subscription.consumergroup; | ||
|
||
import java.time.Duration; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "consumer-group.clean-up") | ||
public class ConsumerGroupCleanUpProperties { | ||
private boolean enabled = true; | ||
private Duration interval = Duration.ofMinutes(5); | ||
private Duration initialDelay = Duration.ofMinutes(1); | ||
private Duration timeout = Duration.ofHours(24); | ||
private boolean removeTasksAfterTimeout = true; | ||
|
||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public void setEnabled(boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
|
||
public Duration getInterval() { | ||
return interval; | ||
} | ||
|
||
public void setInterval(Duration interval) { | ||
this.interval = interval; | ||
} | ||
|
||
public Duration getInitialDelay() { | ||
return initialDelay; | ||
} | ||
|
||
public void setInitialDelay(Duration initialDelay) { | ||
this.initialDelay = initialDelay; | ||
} | ||
|
||
public Duration getTimeout() { | ||
return timeout; | ||
} | ||
|
||
public void setTimeout(Duration timeout) { | ||
this.timeout = timeout; | ||
} | ||
|
||
public void setRemoveTasksAfterTimeout(boolean removeTasksAfterTimeout) { | ||
this.removeTasksAfterTimeout = removeTasksAfterTimeout; | ||
} | ||
|
||
public boolean isRemoveTasksAfterTimeout() { | ||
return removeTasksAfterTimeout; | ||
} | ||
} |
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -461,4 +461,9 @@ private List<SubscriptionNameWithMetrics> getSubscriptionsMetrics( | |
}) | ||
.collect(toList()); | ||
} | ||
|
||
public boolean subscriptionExists(SubscriptionName subscriptionName) { | ||
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. public functions are meant to be at the top of the class, private one are at the bottom, lets not break the convention here 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. sure |
||
return subscriptionRepository.subscriptionExists( | ||
subscriptionName.getTopicName(), subscriptionName.getName()); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ent/domain/subscription/consumergroup/ConsumerGroupAlreadyScheduledToDeleteException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package pl.allegro.tech.hermes.management.domain.subscription.consumergroup; | ||
|
||
import static java.lang.String.format; | ||
|
||
public class ConsumerGroupAlreadyScheduledToDeleteException extends RuntimeException { | ||
|
||
public ConsumerGroupAlreadyScheduledToDeleteException( | ||
ConsumerGroupToDelete consumerGroupToDelete, Throwable e) { | ||
super( | ||
format( | ||
"Consumer group already scheduled to delete, for subscription %s ", | ||
consumerGroupToDelete.subscriptionName().getQualifiedName()), | ||
e); | ||
} | ||
} |
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.
isn't 24h timeout too long? just asking
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.
this timeout indicates after what period of time it should ignore tthe removal of consumer group.
I might change it to lower value, but i'm wondering as well if your question is not brought from the ambigious naiming of this variable. Maybe i should change it to something like "skipAfter" ?