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

snlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 78308da90d update task metadata API response when no metadata (#10301)
78308da90d is described below

commit 78308da90debe5b2fc958750a9a11acc3b9a9e8e
Author: Haitao Zhang <[email protected]>
AuthorDate: Fri Feb 17 18:14:24 2023 -0800

    update task metadata API response when no metadata (#10301)
---
 .../api/exception/NoTaskMetadataException.java     | 29 ----------------------
 .../api/resources/PinotTaskRestletResource.java    |  3 ---
 .../core/minion/PinotHelixTaskResourceManager.java |  4 +--
 3 files changed, 1 insertion(+), 35 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/exception/NoTaskMetadataException.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/exception/NoTaskMetadataException.java
deleted file mode 100644
index 64ffe620ba..0000000000
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/exception/NoTaskMetadataException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.controller.api.exception;
-
-public class NoTaskMetadataException extends RuntimeException {
-  public NoTaskMetadataException(String message) {
-    super(message);
-  }
-
-  public NoTaskMetadataException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}
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 11491061e7..33ee29b07f 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
@@ -74,7 +74,6 @@ import org.apache.pinot.controller.ControllerConf;
 import org.apache.pinot.controller.api.access.AccessType;
 import org.apache.pinot.controller.api.access.Authenticate;
 import 
org.apache.pinot.controller.api.exception.ControllerApplicationException;
-import org.apache.pinot.controller.api.exception.NoTaskMetadataException;
 import org.apache.pinot.controller.api.exception.NoTaskScheduledException;
 import org.apache.pinot.controller.api.exception.TaskAlreadyExistsException;
 import org.apache.pinot.controller.api.exception.UnknownTaskTypeException;
@@ -214,8 +213,6 @@ public class PinotTaskRestletResource {
           String tableNameWithType) {
     try {
       return _pinotHelixTaskResourceManager.getTaskMetadataByTable(taskType, 
tableNameWithType);
-    } catch (NoTaskMetadataException e) {
-      throw new ControllerApplicationException(LOGGER, e.getMessage(), 
Response.Status.NOT_FOUND);
     } catch (JsonProcessingException e) {
       throw new ControllerApplicationException(LOGGER, String
           .format("Failed to format task metadata into Json for task type: %s 
from table: %s", taskType,
diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
index 15851efd5e..4b62b143af 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
@@ -54,7 +54,6 @@ import org.apache.helix.task.WorkflowContext;
 import org.apache.helix.zookeeper.datamodel.ZNRecord;
 import org.apache.pinot.common.minion.MinionTaskMetadataUtils;
 import org.apache.pinot.common.utils.DateTimeUtils;
-import org.apache.pinot.controller.api.exception.NoTaskMetadataException;
 import org.apache.pinot.controller.api.exception.NoTaskScheduledException;
 import org.apache.pinot.controller.api.exception.UnknownTaskTypeException;
 import org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
@@ -918,8 +917,7 @@ public class PinotHelixTaskResourceManager {
     ZkHelixPropertyStore<ZNRecord> propertyStore = 
_helixResourceManager.getPropertyStore();
     ZNRecord raw = MinionTaskMetadataUtils.fetchTaskMetadata(propertyStore, 
taskType, tableNameWithType);
     if (raw == null) {
-      throw new NoTaskMetadataException(
-          String.format("No task metadata for task type: %s from table: %s", 
taskType, tableNameWithType));
+      return JsonUtils.objectToString(JsonUtils.newObjectNode());
     }
     return JsonUtils.objectToString(raw);
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to