AntiTopQuark commented on code in PR #68226: URL: https://github.com/apache/doris/pull/68226#discussion_r4135615136
########## fe/fe-core/src/main/java/org/apache/doris/binlog/RowBinlogTtlDiscovery.java: ########## @@ -0,0 +1,158 @@ +// 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.doris.binlog; + +import org.apache.doris.catalog.Database; +import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.MaterializedIndex; +import org.apache.doris.catalog.OlapTable; +import org.apache.doris.catalog.Partition; +import org.apache.doris.catalog.Table; +import org.apache.doris.catalog.Tablet; +import org.apache.doris.cloud.catalog.CloudReplica; +import org.apache.doris.cloud.system.CloudSystemInfoService; +import org.apache.doris.common.Config; +import org.apache.doris.common.UserException; +import org.apache.doris.proto.InternalService; +import org.apache.doris.rpc.BackendServiceProxy; +import org.apache.doris.rpc.RpcException; +import org.apache.doris.system.Backend; +import org.apache.doris.thrift.TStatusCode; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** Bounded catalog discovery for tablets absent from a BE's metadata cache. */ +public final class RowBinlogTtlDiscovery { + private static final Logger LOG = LogManager.getLogger(RowBinlogTtlDiscovery.class); + private Iterator<Database> databases = Collections.emptyIterator(); + private Iterator<Table> tables = Collections.emptyIterator(); + private Iterator<Partition> partitions = Collections.emptyIterator(); + private Iterator<Tablet> tablets = Collections.emptyIterator(); + private Iterator<MaterializedIndex> indexes = Collections.emptyIterator(); + private OlapTable currentTable; + + public void discover() { + if (!Config.isCloudMode() || !Config.enable_feature_binlog) { + return; + } + try { + CloudSystemInfoService info = (CloudSystemInfoService) Env.getCurrentSystemInfo(); + Map<Long, List<Long>> targets = new HashMap<>(); + long deadline = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(50); + if (!databases.hasNext() && !tables.hasNext() && !partitions.hasNext() + && !indexes.hasNext() && !tablets.hasNext()) { + databases = Env.getCurrentInternalCatalog().getDbs().iterator(); + } + for (int n = 0; n < 64 && System.nanoTime() < deadline; n++) { + Tablet tablet = nextTablet(deadline); + if (tablet == null) { + break; + } + CloudReplica replica = (CloudReplica) tablet.getReplicas().get(0); + // One existing replica owner per compute group. BE read/write separation + // decides which group may compact; Meta Service arbitrates competing jobs. + for (String clusterId : info.getCloudClusterIds()) { + long backendId = replica.getBackendIdWithClusterId(clusterId); Review Comment: done, Fixed by catching `ComputeGroupException ` per compute group and continuing to collect and dispatch targets for healthy groups. -- 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]
