saurabhd336 commented on code in PR #9058: URL: https://github.com/apache/pinot/pull/9058#discussion_r926262334
########## pinot-common/src/main/java/org/apache/pinot/common/minion/TaskGeneratorMostRecentRunInfo.java: ########## @@ -0,0 +1,151 @@ +/** + * 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.common.minion; + +import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.PriorityQueue; +import java.util.Queue; +import java.util.TreeMap; +import javax.annotation.Nonnull; +import org.apache.helix.ZNRecord; + + +/** + * a task generator running history which keeps the most recent several success run timestamp and the most recent + * several error run + * message. + */ +public class TaskGeneratorMostRecentRunInfo extends BaseTaskGeneratorInfo { + @VisibleForTesting + static final int MAX_NUM_OF_HISTORY_TO_KEEP = 5; + @VisibleForTesting + static final String MOST_RECENT_SUCCESS_RUN_TS = "mostRecentSuccessRunTs"; + @VisibleForTesting + static final String MOST_RECENT_ERROR_RUN_MESSAGE = "mostRecentErrorRunMessage"; + + private final String _taskType; + private final String _tableNameWithType; + // the timestamp to error message map of the most recent several error runs + @Nonnull + private final TreeMap<Long, String> _mostRecentErrorRunMessage; + // the timestamp of the most recent several success runs + @Nonnull + private final List<Long> _mostRecentSuccessRunTS; + private final int _version; + + private TaskGeneratorMostRecentRunInfo(String tableNameWithType, String taskType, + Map<Long, String> mostRecentErrorRunMessage, List<Long> mostRecentSuccessRunTS, int version) { + _tableNameWithType = tableNameWithType; + _taskType = taskType; + // sort and keep the most recent several error messages + _mostRecentErrorRunMessage = new TreeMap<>(); Review Comment: Ack -- 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-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org