-
Notifications
You must be signed in to change notification settings - Fork 586
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
Provide idempotency support to handle duplicate maintenance events #1407
Conversation
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.
The overall implementation looks good. But I am wondering whether we can consider the following two options.
-
Use
caffeine cache
(link). Maybe this use case is simple enough and we do not want to introduce a new dependency for it? -
Create a separate class
MaintenanceEventCache
that includes the cache cleaner, cache size/ time retention, etc. There could be several advantages for doing it.
- Improve simplicity/readability/modularity of the
MaintenanceEventDetector
class - The concurrency control can happen on the
MaintenanceEventCache
class level instead ofMaintenanceEventDetector
level (currently,removeOldEventsFromIdempotenceCache
andensureIdempotency
methods are synchronized on theMaintenanceEventDetector
level). It makes more sense to makeMaintenanceEventCache
handle its own concurrent data access. - Improve testability since it's more modular
...l/src/main/java/com/linkedin/kafka/cruisecontrol/common/KafkaCruiseControlThreadFactory.java
Show resolved
Hide resolved
...l/src/main/java/com/linkedin/kafka/cruisecontrol/config/constants/AnomalyDetectorConfig.java
Show resolved
Hide resolved
...l/src/main/java/com/linkedin/kafka/cruisecontrol/config/constants/AnomalyDetectorConfig.java
Show resolved
Hide resolved
...ontrol/src/main/java/com/linkedin/kafka/cruisecontrol/detector/MaintenanceEventDetector.java
Outdated
Show resolved
Hide resolved
...ontrol/src/main/java/com/linkedin/kafka/cruisecontrol/detector/MaintenanceEventDetector.java
Outdated
Show resolved
Hide resolved
...ontrol/src/main/java/com/linkedin/kafka/cruisecontrol/detector/MaintenanceEventDetector.java
Outdated
Show resolved
Hide resolved
Thanks for the review.
|
92ab573
to
0ef70ae
Compare
This PR resolves #1347.