ankitsultana commented on code in PR #9808: URL: https://github.com/apache/pinot/pull/9808#discussion_r1034364823
########## pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/MultiStageStrictReplicaGroupSelector.java: ########## @@ -0,0 +1,150 @@ +/** + * 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.broker.routing.instanceselector; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Preconditions; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.annotation.Nullable; +import org.apache.helix.model.ExternalView; +import org.apache.helix.model.IdealState; +import org.apache.helix.store.zk.ZkHelixPropertyStore; +import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.apache.pinot.broker.routing.adaptiveserverselector.AdaptiveServerSelector; +import org.apache.pinot.common.assignment.InstancePartitions; +import org.apache.pinot.common.assignment.InstancePartitionsUtils; +import org.apache.pinot.common.metrics.BrokerMetrics; +import org.apache.pinot.spi.config.table.TableType; +import org.apache.pinot.spi.config.table.assignment.InstancePartitionsType; +import org.apache.pinot.spi.utils.builder.TableNameBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Instance selector for multi-stage queries which can ensure that Colocated Tables always leverage Colocated Join + * whenever possible. To achieve this, this instance-selector uses InstancePartitions (IP) to determine replica-groups, + * as opposed to IdealState used by other instance-selectors. Moreover, this also uses the requestId generated by + * Pinot broker to determine the replica-group picked for each table involved in the query, as opposed to using a + * member variable. There may be scenarios where an instance in the chosen replica-group is down. In that case, this + * strategy will try to pick another replica-group. For realtime tables, this strategy uses only CONSUMING partitions. Review Comment: Renamed. For multi-stage queries any routing strategy would work. This routing strategy is more focused on ensuring we can leverage colocated joins. Perhaps we should rename this to something that explicitly mentions colocated join in the future. -- 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