You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2021/01/22 02:12:24 UTC

[incubator-pinot] 01/01: Handle scheduler calls with proper response when it's disabled.

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch fixing_scheduler_call
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit fdc40e6a59169ef1b8be6122c221d494b7cbaa17
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Thu Jan 21 18:11:29 2021 -0800

    Handle scheduler calls with proper response when it's disabled.
---
 .../controller/api/resources/PinotTaskRestletResource.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java
index 1555fa9..b149a6b 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java
@@ -186,6 +186,9 @@ public class PinotTaskRestletResource {
   public Map<String, Object> getCronSchedulerInformation()
       throws SchedulerException {
     Scheduler scheduler = _pinotTaskManager.getScheduler();
+    if (scheduler == null) {
+      throw new NotFoundException("Task scheduler is disabled");
+    }
     SchedulerMetaData metaData = scheduler.getMetaData();
     Map<String, Object> schedulerMetaData = new HashMap<>();
     schedulerMetaData.put("Version", metaData.getVersion());
@@ -219,8 +222,11 @@ public class PinotTaskRestletResource {
   @ApiOperation("Fetch cron scheduler job keys")
   public List<JobKey> getCronSchedulerJobKeys()
       throws SchedulerException {
-    List<JobKey> jobKeys = new ArrayList<>();
     Scheduler scheduler = _pinotTaskManager.getScheduler();
+    if (scheduler == null) {
+      throw new NotFoundException("Task scheduler is disabled");
+    }
+    List<JobKey> jobKeys = new ArrayList<>();
     for (String group : scheduler.getTriggerGroupNames()) {
       jobKeys.addAll(scheduler.getJobKeys(GroupMatcher.groupEquals(group)));
     }
@@ -235,6 +241,9 @@ public class PinotTaskRestletResource {
       @ApiParam(value = "Task type") @QueryParam("taskType") String taskType)
       throws SchedulerException {
     Scheduler scheduler = _pinotTaskManager.getScheduler();
+    if (scheduler == null) {
+      throw new NotFoundException("Task scheduler is disabled");
+    }
     JobKey jobKey = JobKey.jobKey(tableName, taskType);
     if (!scheduler.checkExists(jobKey)) {
       throw new NotFoundException(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org