yashmayya commented on code in PR #17576:
URL: https://github.com/apache/pinot/pull/17576#discussion_r2761108881
##########
pinot-controller/src/main/resources/app/components/Query/FlamegraphQueryStageStats.tsx:
##########
@@ -21,6 +21,7 @@ import { Typography, useTheme } from "@material-ui/core";
import "react-flow-renderer/dist/style.css";
import isEmpty from "lodash/isEmpty";
import { FlameGraph } from 'react-flame-graph';
+import {act} from "react-dom/test-utils";
Review Comment:
Seems like an unused testing util that shouldn't be in this prod UI code?
##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/KeepPipelineBreakerStatsPredicate.java:
##########
@@ -0,0 +1,78 @@
+/**
+ * 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.Locale;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.env.PinotConfiguration;
+import org.apache.pinot.spi.utils.CommonConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class KeepPipelineBreakerStatsPredicate implements
PinotClusterConfigChangeListener {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(KeepPipelineBreakerStatsPredicate.class);
+
+ private volatile boolean _skip;
+
+ public KeepPipelineBreakerStatsPredicate(boolean skip) {
+ _skip = skip;
+ }
+
+ // NOTE: When this method is called, the helix manager is not yet connected.
+ public static KeepPipelineBreakerStatsPredicate create(PinotConfiguration
serverConf) {
+ boolean skip = serverConf.getProperty(
+
CommonConstants.MultiStageQueryRunner.KEY_OF_SKIP_PIPELINE_BREAKER_STATS,
+
CommonConstants.MultiStageQueryRunner.DEFAULT_SKIP_PIPELINE_BREAKER_STATS);
+ LOGGER.info("Initialized {} with value: {}",
+
CommonConstants.MultiStageQueryRunner.KEY_OF_SKIP_PIPELINE_BREAKER_STATS, skip);
+ return new KeepPipelineBreakerStatsPredicate(skip);
+ }
+
+ public boolean isEnabled() {
+ return !_skip;
+ }
+
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String>
clusterConfigs) {
+ String key =
CommonConstants.MultiStageQueryRunner.KEY_OF_SKIP_PIPELINE_BREAKER_STATS;
+ if (!changedConfigs.contains(key)) {
+ LOGGER.debug("No change for key: {}, keeping its value as {}", key,
_skip);
+ return;
+ }
+ String value = clusterConfigs.get(key);
+ if (value == null || value.isEmpty()) {
+ LOGGER.info("Empty or null value for key: {}, reset to default: {}",
+ key,
+
CommonConstants.MultiStageQueryRunner.DEFAULT_SKIP_PIPELINE_BREAKER_STATS);
+ _skip =
CommonConstants.MultiStageQueryRunner.DEFAULT_SKIP_PIPELINE_BREAKER_STATS;
+ } else {
+ boolean oldEnabled = _skip;
+ String valueStr = value.trim();
+ _skip = Boolean.parseBoolean(valueStr.toLowerCase(Locale.ENGLISH));
+ if (oldEnabled != _skip) {
+ LOGGER.warn("Updated {} from: {} to: {}, parsed as {}", key, valueStr,
oldEnabled, _skip);
Review Comment:
Why is this a warn log?
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/pipeline/PipelineBreakerOperator.java:
##########
@@ -65,9 +65,10 @@ public Map<Integer, List<MseBlock>> getResultMap() {
@Override
public void registerExecution(long time, int numRows, long memoryUsedBytes,
long gcTimeMs) {
_statMap.merge(StatKey.EXECUTION_TIME_MS, time);
- _statMap.merge(StatKey.EMITTED_ROWS, numRows);
_statMap.merge(StatKey.ALLOCATED_MEMORY_BYTES, memoryUsedBytes);
_statMap.merge(StatKey.GC_TIME_MS, gcTimeMs);
+ // This is actually innecessary given that pipeline breaker does not emit
any rows upstream.
Review Comment:
```suggestion
// This is actually unnecessary given that pipeline breaker does not
emit any rows upstream.
```
nit
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/InStageStatsTreeBuilder.java:
##########
@@ -139,6 +164,45 @@ private long getChildrenStat(MultiStageOperator.Type type,
JsonNode[] children,
.sum();
}
+ @Nullable
+ private ObjectNode extractPipelineBreakerResult(BasePlanNode node, Context
context) {
+ MailboxReceiveNode pipelineBreakerNode = getPipelineBreakerNode(node);
+ if (pipelineBreakerNode == null) {
+ return null;
+ }
+ _index--;
+ return visitMailboxReceive(pipelineBreakerNode, context);
+ }
+
+ @Nullable
+ private MailboxReceiveNode getPipelineBreakerNode(BasePlanNode node) {
+ if (_index == 0) {
+ return null;
+ }
+ MultiStageOperator.Type nextOperatorType =
_stageStats.getOperatorType(_index - 1);
+ if (nextOperatorType != MultiStageOperator.Type.PIPELINE_BREAKER) {
+ // even if the plan may say there is a pipeline breaker, the stats do
not have it
+ return null;
+ }
+ // This code assumes there is a single pipeline breaker in the stage,
which is true for now.
+ ArrayList<PlanNode> nodeStack = new ArrayList<>(1);
+ nodeStack.add(node);
+ while (!nodeStack.isEmpty()) {
+ PlanNode currentNode = nodeStack.remove(nodeStack.size() - 1);
+ if (currentNode instanceof JoinNode) {
+ JoinNode joinNode = (JoinNode) currentNode;
+ if (joinNode.getInputs().size() > 1 && joinNode.getJoinType() ==
JoinRelType.SEMI) {
Review Comment:
Anti joins also use the pipeline breaker mechanism right?
--
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]