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

Enhance task schedule api for single type/table support #6352

Merged
merged 1 commit into from
Dec 17, 2020

Conversation

Jackie-Jiang
Copy link
Contributor

Description

Added 2 optional query parameters to the task schedule API to schedule tasks for the given task type/table.
Examples:

POST /tasks/schedule?taskType=MyTask
POST /tasks/schedule?tableName=myTable_OFFLINE
POST /tasks/schedule?taskType=MyTask&tableName=myTable_OFFLINE

@codecov-io
Copy link

Codecov Report

Merging #6352 (1a3f264) into master (1beaab5) will decrease coverage by 20.89%.
The diff coverage is 51.88%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #6352       +/-   ##
===========================================
- Coverage   66.44%   45.55%   -20.90%     
===========================================
  Files        1075     1291      +216     
  Lines       54773    62186     +7413     
  Branches     8168     9027      +859     
===========================================
- Hits        36396    28331     -8065     
- Misses      15700    31523    +15823     
+ Partials     2677     2332      -345     
Flag Coverage Δ
integration 45.55% <51.88%> (?)

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

Impacted Files Coverage Δ
...ot/broker/broker/AllowAllAccessControlFactory.java 100.00% <ø> (ø)
.../helix/BrokerUserDefinedMessageHandlerFactory.java 52.83% <0.00%> (-13.84%) ⬇️
...org/apache/pinot/broker/queryquota/HitCounter.java 0.00% <0.00%> (-100.00%) ⬇️
...che/pinot/broker/queryquota/MaxHitRateTracker.java 0.00% <0.00%> (ø)
...ache/pinot/broker/queryquota/QueryQuotaEntity.java 0.00% <0.00%> (-50.00%) ⬇️
...ker/routing/instanceselector/InstanceSelector.java 100.00% <ø> (ø)
...ceselector/StrictReplicaGroupInstanceSelector.java 0.00% <0.00%> (ø)
.../main/java/org/apache/pinot/client/Connection.java 22.22% <0.00%> (-26.62%) ⬇️
...not/common/assignment/InstancePartitionsUtils.java 64.28% <ø> (-8.89%) ⬇️
...common/config/tuner/NoOpTableTableConfigTuner.java 0.00% <ø> (ø)
... and 1288 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4183ffe...1a3f264. Read the comment docs.

Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

overall lgtm

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

expand the imports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per the code style, if there are >= 5 imports, they will be combined into *

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, good to know :)

setUpTask();

return tasksScheduled;
return scheduleTasks(_pinotHelixResourceManager.getAllTables(), false);
Copy link
Contributor

Choose a reason for hiding this comment

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

why this is always false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is connected to the rest endpoint, so the caller might not be the leader controller

Copy link
Contributor

Choose a reason for hiding this comment

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

ic, so we actually always assume this call is from a non-leader.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if it is not always the leader, we need to assume it is not the leader

if (taskTypes.contains(enabledTaskType)) {
enabledTableConfigMap.computeIfAbsent(enabledTaskType, k -> new ArrayList<>()).add(tableConfig);
} else {
LOGGER.warn("Task type: {} is not registered, cannot enable it for table: {}", enabledTaskType,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that we return this info to the client-side? I feel this information is useful for users to test and debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. We cannot directly return the message without backward-incompatible change on the rest endpoint (currently returns the map from task type to task scheduled). I made the change so that the returned map contains all the task types within the table configs, and if the task type is not registered, there will be no task scheduled (value is null for the task type), and then user can look into the log and find the reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

true, maybe we add a new array field like "errors" later to hold these information.

@Jackie-Jiang Jackie-Jiang merged commit 2ea0185 into apache:master Dec 17, 2020
@Jackie-Jiang Jackie-Jiang deleted the minion_task_schedule_api branch December 17, 2020 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants