Jackie-Jiang commented on code in PR #12276:
URL: https://github.com/apache/pinot/pull/12276#discussion_r1460301499
##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java:
##########
@@ -99,12 +103,22 @@ abstract class BaseInstanceSelector implements
InstanceSelector {
private volatile SegmentStates _segmentStates;
BaseInstanceSelector(String tableNameWithType,
ZkHelixPropertyStore<ZNRecord> propertyStore,
- BrokerMetrics brokerMetrics, @Nullable AdaptiveServerSelector
adaptiveServerSelector, Clock clock) {
+ BrokerMetrics brokerMetrics, @Nullable AdaptiveServerSelector
adaptiveServerSelector, Clock clock,
+ boolean useFixedReplica) {
_tableNameWithType = tableNameWithType;
_propertyStore = propertyStore;
_brokerMetrics = brokerMetrics;
_adaptiveServerSelector = adaptiveServerSelector;
_clock = clock;
+ _useFixedReplica = useFixedReplica;
+ // Using raw table name to ensure queries spanning across REALTIME and
OFFLINE tables are routed to the same
+ // instance
+ _tableNameHashForFixedReplicaRouting =
TableNameBuilder.extractRawTableName(tableNameWithType).hashCode();
Review Comment:
(minor) We can keep a positive hash here, which avoids the per query abs
##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java:
##########
@@ -87,6 +89,8 @@ abstract class BaseInstanceSelector implements
InstanceSelector {
final BrokerMetrics _brokerMetrics;
final AdaptiveServerSelector _adaptiveServerSelector;
final Clock _clock;
+ final Boolean _useFixedReplica;
Review Comment:
```suggestion
final boolean _useFixedReplica;
```
##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java:
##########
@@ -429,6 +443,12 @@ public SelectionResult select(BrokerRequest brokerRequest,
List<String> segments
}
}
+ protected boolean isUseFixedReplica(Map<String, String> queryOptions) {
+ return Boolean.parseBoolean(
+
queryOptions.getOrDefault(CommonConstants.Broker.Request.QueryOptionKey.USE_FIXED_REPLICA,
Review Comment:
(minor) Suggest moving query option handling into `QueryOptionUtils`, and
avoid per query string conversion:
```
Boolean useFixedReplicaFromQueryOption =
QueryOptionUtils.getUseFixedReplica(queryOptions);
return useFixedReplicaFromQueryOption != null ?
useFixedReplicaFromQueryOption : _useFixedReplica;
```
--
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]