This is an automated email from the ASF dual-hosted git repository.
ankitsultana 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 0c2bac12cd Prevent NPE in minion tasks (#15550)
0c2bac12cd is described below
commit 0c2bac12cd2a05265acb494c7bcc97147187c8c2
Author: Rekha Seethamraju <[email protected]>
AuthorDate: Fri Apr 18 01:22:19 2025 +0530
Prevent NPE in minion tasks (#15550)
---
.../controller/api/resources/TableConfigsRestletResource.java | 5 +++++
.../helix/core/minion/PinotHelixTaskResourceManager.java | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java
index 82a9f164ea..b1cad6cd7b 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java
@@ -37,6 +37,7 @@ import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
+import javax.ws.rs.NotFoundException;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
@@ -161,6 +162,10 @@ public class TableConfigsRestletResource {
try {
tableName = DatabaseUtils.translateTableName(tableName, headers);
Schema schema = _pinotHelixResourceManager.getTableSchema(tableName);
+ if (schema == null) {
+ throw new NotFoundException(
+ String.format("Schema does not exist for table %s Use POST to
create it first.", tableName));
+ }
TableConfig offlineTableConfig =
_pinotHelixResourceManager.getOfflineTableConfig(tableName, false);
TableConfig realtimeTableConfig =
_pinotHelixResourceManager.getRealtimeTableConfig(tableName, false);
TableConfigs config = new TableConfigs(tableName, schema,
offlineTableConfig, realtimeTableConfig);
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 bbbb3fcee2..9ea9bb7216 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
@@ -542,6 +542,7 @@ public class PinotHelixTaskResourceManager {
*/
public synchronized Map<String, String> getTaskRuntimeConfig(String
taskName) {
JobConfig jobConfig = _taskDriver.getJobConfig(getHelixJobName(taskName));
+ Preconditions.checkArgument(jobConfig != null, "Task: %s does not exist",
taskName);
HashMap<String, String> configs = new HashMap<>();
configs.put("ConcurrentTasksPerWorker",
String.valueOf(jobConfig.getNumConcurrentTasksPerInstance()));
configs.put("TaskTimeoutMs",
String.valueOf(jobConfig.getTimeoutPerTask()));
@@ -961,7 +962,12 @@ public class PinotHelixTaskResourceManager {
* @return Task type
*/
private static String getTaskType(String name) {
- return name.split(TASK_NAME_SEPARATOR)[1];
+ String[] parts = name.split(TASK_NAME_SEPARATOR);
+ if (parts.length < 2) {
+ throw new IllegalArgumentException(String.format("Invalid task name :
%s. Missing separator %s",
+ name, TASK_NAME_SEPARATOR));
+ }
+ return parts[1];
}
public String getParentTaskName(String taskType, String taskName) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]