You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "gianm (via GitHub)" <gi...@apache.org> on 2023/03/21 02:03:35 UTC

[GitHub] [druid] gianm commented on a diff in pull request #13909: Add segment generator counters to MSQ reports

gianm commented on code in PR #13909:
URL: https://github.com/apache/druid/pull/13909#discussion_r1142828341


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/counters/SegmentGenerationProgressCounter.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * 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.druid.msq.counters;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
+
+import javax.annotation.Nullable;
+import java.util.Objects;
+
+/**
+ * Counters for segment generation phase. Created by {@link CounterTracker#segmentGenerationProgress()}.
+ */
+public class SegmentGenerationProgressCounter implements QueryCounter
+{
+  @GuardedBy("this")
+  private long rowsProcessed = 0L;
+
+  @GuardedBy("this")
+  private long rowsPersisted = 0L;
+
+  @GuardedBy("this")
+  private long rowsMerged = 0L;
+
+  public void incrementRowProcessed(long rowsProcessed)

Review Comment:
   `incrementRowsProcessed` (spelling)



##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderator.java:
##########
@@ -785,6 +785,9 @@ private DataSegment mergeAndPush(
         for (FireHydrant fireHydrant : sink) {
           Pair<ReferenceCountingSegment, Closeable> segmentAndCloseable = fireHydrant.getAndIncrementSegment();
           final QueryableIndex queryableIndex = segmentAndCloseable.lhs.asQueryableIndex();
+          if (queryableIndex != null) {
+            metrics.incrementMergeRows(queryableIndex.getNumRows());

Review Comment:
   This isn't the right place to increment the number of rows merged; it's happening _before_ merge so it's really the number of rows that are about-to-be-merged. If you want the number of rows actually merged, the hook point should be after `mergeQueryableIndex` is done.



-- 
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-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org