lnbest0707-uber commented on code in PR #15782: URL: https://github.com/apache/pinot/pull/15782#discussion_r2249495649
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/periodictask/RealtimeOffsetAutoResetKafkaHandler.java: ########## @@ -0,0 +1,135 @@ +/** + * 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.helix.core.periodictask; + +import com.google.common.base.Preconditions; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.apache.pinot.controller.helix.core.PinotHelixResourceManager; +import org.apache.pinot.controller.helix.core.realtime.PinotLLCRealtimeSegmentManager; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.stream.OffsetCriteria; +import org.apache.pinot.spi.stream.StreamConfig; +import org.apache.pinot.spi.stream.StreamConfigProperties; +import org.apache.pinot.spi.utils.IngestionConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public abstract class RealtimeOffsetAutoResetKafkaHandler extends RealtimeOffsetAutoResetHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(RealtimeOffsetAutoResetKafkaHandler.class); + private static final String STREAM_TYPE = "kafka"; + + public RealtimeOffsetAutoResetKafkaHandler(PinotLLCRealtimeSegmentManager llcRealtimeSegmentManager, + PinotHelixResourceManager pinotHelixResourceManager) { + super(llcRealtimeSegmentManager, pinotHelixResourceManager); + } + + /** + * Trigger the job to backfill the skipped interval due to offset auto reset. + * It is expected to backfill the [fromOffset, toOffset) interval. + * @return true if successfully started the backfill job and its ingestion + */ + @Override + public boolean triggerBackfillJob( + String tableNameWithType, StreamConfig streamConfig, String topicName, int partitionId, long fromOffset, + long toOffset) { + Map<String, String> newTopicStreamConfig = triggerDataReplicationAndGetTopicInfo( + tableNameWithType, streamConfig, topicName, partitionId, fromOffset, toOffset); + if (newTopicStreamConfig == null) { + return false; + } + try { + TableConfig currentTableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType); + addNewTopicToTableConfig(newTopicStreamConfig, currentTableConfig); Review Comment: Yes it is. The design doc explains it. I would also add comments. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
