You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by sn...@apache.org on 2023/02/18 02:14:38 UTC

[pinot] branch revert-10301-update-task-metadata-API created (now ce8ee3e612)

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

snlee pushed a change to branch revert-10301-update-task-metadata-API
in repository https://gitbox.apache.org/repos/asf/pinot.git


      at ce8ee3e612 Revert "update task metadata API response when no metadata (#10301)"

This branch includes the following new commits:

     new ce8ee3e612 Revert "update task metadata API response when no metadata (#10301)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[pinot] 01/01: Revert "update task metadata API response when no metadata (#10301)"

Posted by sn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

snlee pushed a commit to branch revert-10301-update-task-metadata-API
in repository https://gitbox.apache.org/repos/asf/pinot.git

commit ce8ee3e612809b2b0d050bf6236513d8b02513a8
Author: Seunghyun Lee <sn...@apache.org>
AuthorDate: Fri Feb 17 18:14:33 2023 -0800

    Revert "update task metadata API response when no metadata (#10301)"
    
    This reverts commit 78308da90debe5b2fc958750a9a11acc3b9a9e8e.
---
 .../api/exception/NoTaskMetadataException.java     | 29 ++++++++++++++++++++++
 .../api/resources/PinotTaskRestletResource.java    |  3 +++
 .../core/minion/PinotHelixTaskResourceManager.java |  4 ++-
 3 files changed, 35 insertions(+), 1 deletion(-)

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
new file mode 100644
index 0000000000..64ffe620ba
--- /dev/null
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/exception/NoTaskMetadataException.java
@@ -0,0 +1,29 @@
+/**
+ * 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 33ee29b07f..11491061e7 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,6 +74,7 @@ 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;
@@ -213,6 +214,8 @@ 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 4b62b143af..15851efd5e 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,6 +54,7 @@ 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;
@@ -917,7 +918,8 @@ public class PinotHelixTaskResourceManager {
     ZkHelixPropertyStore<ZNRecord> propertyStore = _helixResourceManager.getPropertyStore();
     ZNRecord raw = MinionTaskMetadataUtils.fetchTaskMetadata(propertyStore, taskType, tableNameWithType);
     if (raw == null) {
-      return JsonUtils.objectToString(JsonUtils.newObjectNode());
+      throw new NoTaskMetadataException(
+          String.format("No task metadata for task type: %s from table: %s", taskType, tableNameWithType));
     }
     return JsonUtils.objectToString(raw);
   }


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