-
Notifications
You must be signed in to change notification settings - Fork 369
[AMORO-3440] Implement the refresh and exploration of OptimizingGroup… #3457
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3457 +/- ##
============================================
+ Coverage 21.59% 21.74% +0.15%
- Complexity 2353 2386 +33
============================================
Files 431 431
Lines 40347 40476 +129
Branches 5711 5741 +30
============================================
+ Hits 8712 8801 +89
- Misses 30903 30929 +26
- Partials 732 746 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
54ff948 to
9c3fd97
Compare
zhoujinsong
left a comment
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.
Thanks for the work!
I left some comments, PTAL.
amoro-ams/src/main/java/org/apache/amoro/server/resource/DefaultOptimizerManager.java
Outdated
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/resource/DefaultOptimizerManager.java
Outdated
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/resource/DefaultOptimizerManager.java
Outdated
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/persistence/mapper/TableMetaMapper.java
Outdated
Show resolved
Hide resolved
amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java
Outdated
Show resolved
Hide resolved
e63e960 to
01931b8
Compare
| .durationType() | ||
| .defaultValue(Duration.ofSeconds(30)) | ||
| .withDescription("Optimizer group refresh interval."); | ||
|
|
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.
Do we need to add this configuration to the Helm chart and configuration document (in the next PR)?
| Set<String> groupNames = | ||
| resourceGroups.stream().map(ResourceGroup::getName).collect(Collectors.toSet()); | ||
| Sets.difference(optimizingQueueByGroup.keySet(), groupNames) | ||
| .forEach(DefaultOptimizingService.this::deleteResourceGroup); |
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.
Currently, this::deleteResourceGroup will call OptimizingQueue#dispose(), it only unregister the metric, do we need to cleanup other states in OptimizingQueue there?
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.
What else do you think should added to the disposal process?
The code looks safe according to the existing codes in the master branch.
But I am not sure if it is possible some process is open in the queue will be deleted.
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.
Do we need to handle the tableQueue and retryTaskQueue here?
the lifetime of tableQueue and retryTaskQueue is the same as OptimizingQueue, if the queue has been disposed, maybe we should handle the resource it contains(such as tableQueue and retryTaskQueue)
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 group can be dropped only if there is no table in it, so the tableQueue and retryTaskQueue should be empty.
But I am okay with adding more checks to the dispose method, we may improve it in another PR.
|
|
||
| public DefaultOptimizerManager(Configurations serverConfiguration) { | ||
| private final CatalogManager catalogManager; | ||
| private final MaintainedTableManager tableManager; |
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.
it seems the tableManager does not need here
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.
Yes, it can be dropped.
zhoujinsong
left a comment
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 PR looks good to me in general except some minor suggestions.
| Set<String> groupNames = | ||
| resourceGroups.stream().map(ResourceGroup::getName).collect(Collectors.toSet()); | ||
| Sets.difference(optimizingQueueByGroup.keySet(), groupNames) | ||
| .forEach(DefaultOptimizingService.this::deleteResourceGroup); |
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.
What else do you think should added to the disposal process?
The code looks safe according to the existing codes in the master branch.
But I am not sure if it is possible some process is open in the queue will be deleted.
|
|
||
| public DefaultOptimizerManager(Configurations serverConfiguration) { | ||
| private final CatalogManager catalogManager; | ||
| private final MaintainedTableManager tableManager; |
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.
Yes, it can be dropped.
06d87d5 to
548eadc
Compare
548eadc to
5ac2bfe
Compare
zhoujinsong
left a comment
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.
LGTM.
Why are the changes needed?
Close #3440 .
Brief change log
The OptimizingService and OptimizerManager have been decoupled: the OptimizerManager handles metadata persistence and modifications, while the OptimizingService includes a watcher to synchronize the in-memory OptimizingQueue map with persisted data.
This allows the master node to run the OptimizingService while other nodes modify metadata via a web interface, ensuring the master stays updated.
How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before making a pull request
Documentation