Skip to content
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

Refactor PinotTaskManager class #12964

Merged
merged 3 commits into from
Apr 19, 2024

Conversation

tibrewalpratik17
Copy link
Contributor

@tibrewalpratik17 tibrewalpratik17 commented Apr 18, 2024

label:
refactor

The PinotTaskManager had a lot of scheduleTask methods which was making it unreadable and hard to make changes as adding a new param needs to properly vetted throughout the code.

This change leaves 6 public methods in the class:

  • Map<String, List> scheduleAllTasksForAllTables(String minionInstanceTag)
  • Map<String, List> scheduleAllTasksForDatabase(String database, String minionInstanceTag)
  • Map<String, List> scheduleAllTasksForTable(String tableNameWithType, String minionInstanceTag)
  • List scheduleTaskForAllTables(String taskType, String minionInstanceTag)
  • List scheduleTaskForDatabase(String taskType, String database, String minionInstanceTag)
  • List scheduleTaskForTable(String taskType, String tableNameWithType, String minionInstanceTag)

The first 3 methods schedules all the tasks for given table / database / cluster. The next 3 methods, schedules the task type specified for database / tables / cluster.

This makes the code more readable and easy to use.

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 62.20%. Comparing base (59551e4) to head (6095c30).
Report is 344 commits behind head on master.

Files Patch % Lines
...controller/helix/core/minion/PinotTaskManager.java 0.00% 19 Missing ⚠️
...roller/api/resources/PinotTaskRestletResource.java 0.00% 4 Missing ⚠️
...ntroller/helix/core/minion/CronJobScheduleJob.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12964      +/-   ##
============================================
+ Coverage     61.75%   62.20%   +0.45%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2502      +66     
  Lines        133233   136503    +3270     
  Branches      20636    21128     +492     
============================================
+ Hits          82274    84913    +2639     
- Misses        44911    45318     +407     
- Partials       6048     6272     +224     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 62.15% <0.00%> (+0.44%) ⬆️
java-21 62.06% <0.00%> (+0.44%) ⬆️
skip-bytebuffers-false 62.18% <0.00%> (+0.43%) ⬆️
skip-bytebuffers-true 62.02% <0.00%> (+34.29%) ⬆️
temurin 62.20% <0.00%> (+0.45%) ⬆️
unittests 62.20% <0.00%> (+0.45%) ⬆️
unittests1 46.74% <ø> (-0.15%) ⬇️
unittests2 27.96% <0.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest keeping the following APIs:

  • Map<String, List<String>> scheduleTasksForAllTables(@Nullable String minionInstanceTag)
  • Map<String, List<String>> scheduleTasksForDatabase(@Nullable String database, @Nullable String minionInstanceTag)
  • Map<String, List<String>> scheduleTasksForTable(String tableNameWithType, @Nullable String minionInstanceTag)
  • List<String> scheduleTaskForAllTables(String taskType, @Nullable String minionInstanceTag)
  • List<String> scheduleTaskForDatabase(String taskType, @Nullable String database, @Nullable String minionInstanceTag)
  • List<String> scheduleTaskForTable(String taskType, String tableNameWithType, @Nullable String minionInstanceTag)

@Jackie-Jiang Jackie-Jiang added the incompatible Indicate PR that introduces backward incompatibility label Apr 18, 2024
@Jackie-Jiang Jackie-Jiang merged commit e1b0e53 into apache:master Apr 19, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible Indicate PR that introduces backward incompatibility minion refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants