albertobastos commented on code in PR #15312: URL: https://github.com/apache/pinot/pull/15312#discussion_r2005236269
########## pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/BlockingMultiStreamConsumer.java: ########## @@ -244,11 +244,14 @@ private E readBlockOrNull() { public static class OfTransferableBlock extends BlockingMultiStreamConsumer<TransferableBlock> { - private final MultiStageQueryStats _stats; + private final int _stageId; + @Nullable + private volatile MultiStageQueryStats _stats; public OfTransferableBlock(OpChainExecutionContext context, List<? extends AsyncStream<TransferableBlock>> asyncProducers) { super(context.getId(), context.getDeadlineMs(), asyncProducers); + _stageId = context.getStageId(); _stats = MultiStageQueryStats.emptyStats(context.getStageId()); Review Comment: nit: use the already set `_stageId` variable ########## pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/QueryRunner.java: ########## @@ -130,13 +131,14 @@ public class QueryRunner { private JoinOverFlowMode _joinOverflowMode; @Nullable private PhysicalTimeSeriesServerPlanVisitor _timeSeriesPhysicalPlanVisitor; + private BooleanSupplier _sendStats; /** * Initializes the query executor. * <p>Should be called only once and before calling any other method. */ public void init(PinotConfiguration config, InstanceDataManager instanceDataManager, HelixManager helixManager, - ServerMetrics serverMetrics, @Nullable TlsConfig tlsConfig) { + ServerMetrics serverMetrics, @Nullable TlsConfig tlsConfig, BooleanSupplier sendStats) { Review Comment: I was going to propose to have a global singleton for the `sendStats` boolean properly initialized by the `BaseServerStarter` and updated by the Helix Manager, but then I saw you want to use a custom supplier in just a few places... Can you think of any strategy to avoid adding this extra parameter in so many places? ########## pinot-server/src/main/java/org/apache/pinot/server/starter/helix/SendStatsPredicate.java: ########## @@ -0,0 +1,160 @@ +/** + * 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.server.starter.helix; + +import java.util.List; +import java.util.Locale; +import java.util.concurrent.atomic.AtomicBoolean; +import javax.annotation.Nullable; +import org.apache.helix.NotificationContext; +import org.apache.helix.api.listeners.InstanceConfigChangeListener; +import org.apache.helix.model.InstanceConfig; +import org.apache.pinot.common.version.PinotVersion; +import org.apache.pinot.spi.env.PinotConfiguration; +import org.apache.pinot.spi.utils.CommonConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public abstract class SendStatsPredicate implements InstanceConfigChangeListener { Review Comment: Some javadoc here... ########## pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/plan/pipeline/PipelineBreakerExecutorTest.java: ########## @@ -101,6 +104,15 @@ public void tearDownMethod() _mocks.close(); } + @VisibleForTesting Review Comment: Do we need the `@VisibleForTesting` annotation in a Test class? I'm guessing you forgot to remove it after copy-paste it from `PipelineBreakerExecutor`. -- 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