You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/04/25 23:23:05 UTC

[GitHub] [pinot] jackjlli commented on a diff in pull request #8589: Implement builtin-purge task

jackjlli commented on code in PR #8589:
URL: https://github.com/apache/pinot/pull/8589#discussion_r858095941


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");
+        _clusterInfoAccessor = clusterInfoAccessor;
+    }
+
+
+    @Override
+    public String getTaskType() {
+        return MinionConstants.PurgeTask.TASK_TYPE;
+    }
+
+
+
+    @Override
+    public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
+        String taskType = MinionConstants.PurgeTask.TASK_TYPE;
+        List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
+        Set<Segment> runningSegments =
+                TaskGeneratorUtils.getRunningSegments(MinionConstants.PurgeTask.TASK_TYPE, _clusterInfoAccessor);
+        for (TableConfig tableConfig : tableConfigs) {
+            String tableName = tableConfig.getTableName();

Review Comment:
   Can we check the table type before getting the task configs? E.g. realtime tables may not have any task configs.



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");
+        _clusterInfoAccessor = clusterInfoAccessor;
+    }
+
+
+    @Override
+    public String getTaskType() {
+        return MinionConstants.PurgeTask.TASK_TYPE;
+    }
+
+
+
+    @Override
+    public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
+        String taskType = MinionConstants.PurgeTask.TASK_TYPE;
+        List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
+        Set<Segment> runningSegments =
+                TaskGeneratorUtils.getRunningSegments(MinionConstants.PurgeTask.TASK_TYPE, _clusterInfoAccessor);
+        for (TableConfig tableConfig : tableConfigs) {
+            String tableName = tableConfig.getTableName();
+            TableTaskConfig tableTaskConfig = tableConfig.getTaskConfig();
+            Preconditions.checkNotNull(tableTaskConfig);
+            Map<String, String> taskConfigs =
+                    tableTaskConfig.getConfigsForTaskType(MinionConstants.PurgeTask.TASK_TYPE);
+            Preconditions.checkNotNull(taskConfigs, "Task config shouldn't be null for Table: {}", tableName);
+
+            LOGGER.info("Start generating task configs for table: {} for task: {}", tableName, taskType);
+
+            if (tableConfig.getTableType() == TableType.REALTIME) {
+                LOGGER.info("Task type : {}, cannot be run on table of type  {}",
+                        taskType, TableType.REALTIME);
+                continue;
+            }
+                // Get max number of tasks for this table
+            int tableMaxNumTasks;
+            String tableMaxNumTasksConfig = taskConfigs.get(MinionConstants.TABLE_MAX_NUM_TASKS_KEY);
+            if (tableMaxNumTasksConfig != null) {
+                try {
+                    tableMaxNumTasks = Integer.parseInt(tableMaxNumTasksConfig);
+                } catch (Exception e) {
+                    tableMaxNumTasks = Integer.MAX_VALUE;

Review Comment:
   Print a log here to warn that the value is incorrectly set?



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);

Review Comment:
   Same here. Change it to `private`.



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;

Review Comment:
   Change it to `private`?



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");
+        _clusterInfoAccessor = clusterInfoAccessor;
+    }
+
+
+    @Override
+    public String getTaskType() {
+        return MinionConstants.PurgeTask.TASK_TYPE;
+    }
+
+
+
+    @Override
+    public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
+        String taskType = MinionConstants.PurgeTask.TASK_TYPE;
+        List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
+        Set<Segment> runningSegments =
+                TaskGeneratorUtils.getRunningSegments(MinionConstants.PurgeTask.TASK_TYPE, _clusterInfoAccessor);
+        for (TableConfig tableConfig : tableConfigs) {
+            String tableName = tableConfig.getTableName();
+            TableTaskConfig tableTaskConfig = tableConfig.getTaskConfig();
+            Preconditions.checkNotNull(tableTaskConfig);
+            Map<String, String> taskConfigs =
+                    tableTaskConfig.getConfigsForTaskType(MinionConstants.PurgeTask.TASK_TYPE);
+            Preconditions.checkNotNull(taskConfigs, "Task config shouldn't be null for Table: {}", tableName);

Review Comment:
   If one table fails on this precondition, the whole purge task generation for other tables will be stopped. Maybe we should continue with other tables?



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");
+        _clusterInfoAccessor = clusterInfoAccessor;
+    }
+
+
+    @Override
+    public String getTaskType() {
+        return MinionConstants.PurgeTask.TASK_TYPE;
+    }
+
+
+
+    @Override
+    public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
+        String taskType = MinionConstants.PurgeTask.TASK_TYPE;
+        List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
+        Set<Segment> runningSegments =
+                TaskGeneratorUtils.getRunningSegments(MinionConstants.PurgeTask.TASK_TYPE, _clusterInfoAccessor);
+        for (TableConfig tableConfig : tableConfigs) {
+            String tableName = tableConfig.getTableName();
+            TableTaskConfig tableTaskConfig = tableConfig.getTaskConfig();
+            Preconditions.checkNotNull(tableTaskConfig);
+            Map<String, String> taskConfigs =
+                    tableTaskConfig.getConfigsForTaskType(MinionConstants.PurgeTask.TASK_TYPE);
+            Preconditions.checkNotNull(taskConfigs, "Task config shouldn't be null for Table: {}", tableName);
+
+            LOGGER.info("Start generating task configs for table: {} for task: {}", tableName, taskType);
+
+            if (tableConfig.getTableType() == TableType.REALTIME) {
+                LOGGER.info("Task type : {}, cannot be run on table of type  {}",
+                        taskType, TableType.REALTIME);
+                continue;
+            }
+                // Get max number of tasks for this table

Review Comment:
   Please align with the indentation 



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");

Review Comment:
   Update the message to sth like `Initializing purge task`?



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskGenerator.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.plugin.minion.tasks.purge;
+
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.common.data.Segment;
+import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
+import org.apache.pinot.controller.helix.core.minion.ClusterInfoAccessor;
+import org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.minion.PinotTaskConfig;
+import org.apache.pinot.spi.annotations.minion.TaskGenerator;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@TaskGenerator
+public class PurgeTaskGenerator implements PinotTaskGenerator {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(PurgeTaskGenerator.class);
+
+    private static final PurgeTaskGenerator INSTANCE = new PurgeTaskGenerator();
+
+    protected ClusterInfoAccessor _clusterInfoAccessor;
+
+    public static Object newInstance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public void init(ClusterInfoAccessor clusterInfoAccessor) {
+        LOGGER.info("I'm in init for the purge");
+        _clusterInfoAccessor = clusterInfoAccessor;
+    }
+
+
+    @Override
+    public String getTaskType() {
+        return MinionConstants.PurgeTask.TASK_TYPE;
+    }
+
+
+
+    @Override
+    public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {

Review Comment:
   There are another abstract method `List<PinotTaskConfig> generateTasks(TableConfig tableConfig, Map<String, String> taskConfigs)
         throws Exception;` 
   You may also need to override that in this class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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