You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "adithyachakilam (via GitHub)" <gi...@apache.org> on 2024/02/22 22:50:57 UTC

[PR] [WIP] Enable segments read/published stats on Compaction task completion reports (druid)

adithyachakilam opened a new pull request, #15947:
URL: https://github.com/apache/druid/pull/15947

   <!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
   
   <!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
   
   Fixes #XXXX.
   
   <!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
   
   <!-- If you are a committer, follow the PR action item checklist for committers:
   https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
   
   ### Description
   
   <!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
   
   <!-- Describe your patch: what did you change in code? How did you fix the problem? -->
   
   <!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
   
   #### Fixed the bug ...
   #### Renamed the class ...
   #### Added a forbidden-apis entry ...
   
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   #### Release note
   <!-- Give your best effort to summarize your changes in a couple of sentences aimed toward Druid users. 
   
   If your change doesn't have end user impact, you can skip this section.
   
   For tips about how to write a good release note, see [Release notes](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#release-notes).
   
   -->
   
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `MyFoo`
    * `OurBar`
    * `TheirBaz`
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1514715332


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -920,7 +928,6 @@ TaskStatus runRangePartitionMultiPhaseParallel(TaskToolbox toolbox) throws Excep
     TaskState mergeState = runNextPhase(mergeRunner);
     TaskStatus taskStatus;
     if (mergeState.isSuccess()) {
-      publishSegments(toolbox, mergeRunner.getReports());

Review Comment:
   yeah, by mistake. need to get morning coffee..



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1513743509


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/IngestionStatsAndErrorsTaskReportData.java:
##########
@@ -113,6 +123,22 @@ public Map<String, Long> getRecordsProcessed()
     return recordsProcessed;
   }
 
+  @JsonProperty
+  @Nullable

Review Comment:
   Optional: Maybe also mark these new fields as `Nullable` in the constructor.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentGenerateTask.java:
##########
@@ -125,9 +126,13 @@ public final TaskStatus runTask(TaskToolbox toolbox) throws Exception
         toolbox.getIndexingTmpDir()
     );
 
-    Map<String, TaskReport> taskReport = getTaskCompletionReports();
+    Map<String, TaskReport> taskReport = getTaskCompletionReports(getSegementsSize(inputSource));
 
-    taskClient.report(createGeneratedPartitionsReport(toolbox, segments, taskReport));
+    taskClient.report(createGeneratedPartitionsReport(
+        toolbox,
+        segments,
+        taskReport
+    ));

Review Comment:
   Original code was more readable. If you do want to break the line however, this style would be better.
   
   ```suggestion
       taskClient.report(
           createGeneratedPartitionsReport(toolbox, segments, taskReport)
       );
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1643,6 +1660,13 @@ private Pair<Map<String, Object>, Map<String, Object>> doGetRowStatsAndUnparseab
             getBuildSegmentsStatsFromTaskReport(taskReport, true, unparseableEvents);
 
         buildSegmentsRowStats.addRowIngestionMetersTotals(rowStatsForCompletedTask);
+
+        Long segmentsRead = ((IngestionStatsAndErrorsTaskReport)

Review Comment:
   Rename to `segmentsReadFromPartition` to keep CodeQL from complaining.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentGenerateTask.java:
##########
@@ -149,6 +154,15 @@ abstract T createGeneratedPartitionsReport(
       Map<String, TaskReport> taskReport
   );
 
+  private Long getSegementsSize(InputSource inputSource)
+  {
+    if (inputSource instanceof DruidInputSource) {
+      return (long) ((DruidInputSource) inputSource).getSegmentIds().size();

Review Comment:
   I guess after the `DruidInputSource` has been split, the `segmentIds` would always be non-null. But it is probably still better to add a null check here just in case.



##########
integration-tests/src/test/java/org/apache/druid/tests/indexer/ITCompactionTaskTest.java:
##########
@@ -138,6 +140,54 @@ public void testCompactionWithQueryGranularityInGranularitySpec() throws Excepti
     }
   }
 
+  @Test
+  public void testParallelHashedCompaction() throws Exception

Review Comment:
   Thanks for adding the IT.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentGenerateTask.java:
##########
@@ -149,6 +154,15 @@ abstract T createGeneratedPartitionsReport(
       Map<String, TaskReport> taskReport
   );
 
+  private Long getSegementsSize(InputSource inputSource)

Review Comment:
   ```suggestion
     private Long getNumSegmentsRead(InputSource inputSource)
   ```



##########
docs/ingestion/tasks.md:
##########
@@ -155,6 +155,12 @@ For some task types, the indexing task can wait for the newly ingested segments
 |`segmentAvailabilityWaitTimeMs`|Milliseconds waited by the ingestion task for the newly ingested segments to be available for query after completing ingestion was completed.|
 |`recordsProcessed`| Partitions that were processed by an ingestion task and includes count of records processed from each partition.|
 
+
+|Field| Description|

Review Comment:
   Please add a heading for this section and explain when these stats are populated.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -650,7 +652,17 @@ private TaskStatus runSinglePhaseParallel(TaskToolbox toolbox) throws Exception
     TaskStatus taskStatus;
     if (state.isSuccess()) {
       //noinspection ConstantConditions
-      publishSegments(toolbox, parallelSinglePhaseRunner.getReports());
+      segmentsPublished = publishSegments(toolbox, parallelSinglePhaseRunner.getReports());
+      if (isCompactionTask) {
+        // segements are only read for compactiont tasks. For `index_parallel`
+        // tasks this would result to 0, but we want to rather have it as null
+        // because segmentsRead is not applicable for such tasks.

Review Comment:
   We can simplify this comment:
   
   ```suggestion
           // Populate segmentsRead only for compaction tasks
   ```
   
   Also, it might not be entire true as segments are also read during a re-index task which still qualifies as `index_parallel`.
   
   In the future, you could even consider:
   1. Getting rid of the if condition altogether. The only drawback would be that in batch ingestion jobs where the input source is not Druid, we would report the `segmentsRead` as `0` instead of `null`.
   OR
   2. Populating `segmentsRead` if the input source is `DruidInputSource`.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1200,6 +1212,8 @@ private void publishSegments(
     } else {
       throw new ISE("Failed to publish segments");
     }
+
+    return newSegments.size();

Review Comment:
   Nit: If the result of `publishSegments` is always assigned to `segmentsPublished`, we might as well just assign it here.
   
   ```suggestion
       segmentsPublished = newSegments.size();
   ```



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512106178


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -651,6 +654,14 @@ private TaskStatus runSinglePhaseParallel(TaskToolbox toolbox) throws Exception
     if (state.isSuccess()) {
       //noinspection ConstantConditions
       publishSegments(toolbox, parallelSinglePhaseRunner.getReports());
+      segmentsRead = parallelSinglePhaseRunner.getReports()
+                                              .values()
+                                              .stream()
+                                              .mapToLong(report -> report.getOldSegments().size()).sum();
+      segmentsPublished = parallelSinglePhaseRunner.getReports()
+                                              .values()
+                                              .stream()
+                                                   .mapToLong(report -> report.getNewSegments().size()).sum();

Review Comment:
   nit: this formatting looks a little off?



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/ParallelCompactionTaskReportData.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.indexing.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.indexer.IngestionState;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+import java.util.Objects;
+
+public class ParallelCompactionTaskReportData extends IngestionStatsAndErrorsTaskReportData

Review Comment:
   javadocs please



##########
docs/ingestion/tasks.md:
##########
@@ -155,6 +155,14 @@ For some task types, the indexing task can wait for the newly ingested segments
 |`segmentAvailabilityWaitTimeMs`|Milliseconds waited by the ingestion task for the newly ingested segments to be available for query after completing ingestion was completed.|
 |`recordsProcessed`| Partitions that were processed by an ingestion task and includes count of records processed from each partition.|
 
+
+#### Compaction Task Fields
+
+| Field               | Description                                           |
+|---------------------|-------------------------------------------------------|
+| `segmentsRead`      | # of segments read by a parallel compaction task      |
+| `segmentsPublished` | # of segments published by a parallel compaction task |

Review Comment:
   ```suggestion
   |Field| Description |
   |---|---|
   | `segmentsRead`| Number of segments read by compaction task with more than 1 subtask.|
   | `segmentsPublished`| Number of segments published by a parallel compaction task |
   ```
   
   nit: Minimal spacing in the table format to match other tables in this doc. https://github.com/apache/druid/blob/master/dev/druid_intellij_formatting.xml#L77-L80 - this change in the intelliJ formatting makes it so that intelliJ doesn't auto-format these tables.
   
   https://github.com/apache/druid/blob/master/dev/intellij-setup.md - more detailed instructions on setting up the IDE to avoid formatting diffs in patches.



##########
integration-tests/src/test/java/org/apache/druid/tests/indexer/ITCompactionTaskTest.java:
##########
@@ -220,6 +271,9 @@ private void loadDataAndCompact(
 
       Map<String, IngestionStatsAndErrorsTaskReport> reports = indexer.getTaskReport(taskId);
       Assert.assertTrue(reports != null && reports.size() > 0);
+
+      System.out.println(reports.size());
+      System.out.println(Arrays.toString(reports.values().stream().map(r -> r.toString()).toArray()));

Review Comment:
   Un-needed? If this is useful debug info - can we use the logger `LOG` and add some text explaining what this is



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1513737991


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/ParallelCompactionTaskReportData.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.indexing.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.indexer.IngestionState;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * This class has fields specific to the parallel compaction task and hence extends the generic
+ * task report data {@link IngestionStatsAndErrorsTaskReportData}
+ */
+public class ParallelCompactionTaskReportData extends IngestionStatsAndErrorsTaskReportData

Review Comment:
   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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1514715332


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -920,7 +928,6 @@ TaskStatus runRangePartitionMultiPhaseParallel(TaskToolbox toolbox) throws Excep
     TaskState mergeState = runNextPhase(mergeRunner);
     TaskStatus taskStatus;
     if (mergeState.isSuccess()) {
-      publishSegments(toolbox, mergeRunner.getReports());

Review Comment:
   yeah, by mistake.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512535444


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -651,6 +654,15 @@ private TaskStatus runSinglePhaseParallel(TaskToolbox toolbox) throws Exception
     if (state.isSuccess()) {
       //noinspection ConstantConditions
       publishSegments(toolbox, parallelSinglePhaseRunner.getReports());
+      segmentsRead = parallelSinglePhaseRunner.getReports()
+                                              .values()
+                                              .stream()
+                                              .mapToLong(report -> report.getOldSegments().size()).sum();
+      segmentsPublished = parallelSinglePhaseRunner.getReports()

Review Comment:
   Why is `segmentsPublished` not directly assigned the result of `publishSegments()` like in the other places?



##########
docs/ingestion/tasks.md:
##########
@@ -155,6 +155,12 @@ For some task types, the indexing task can wait for the newly ingested segments
 |`segmentAvailabilityWaitTimeMs`|Milliseconds waited by the ingestion task for the newly ingested segments to be available for query after completing ingestion was completed.|
 |`recordsProcessed`| Partitions that were processed by an ingestion task and includes count of records processed from each partition.|
 
+
+|Field| Description |
+|---|---|
+| `segmentsRead`| Number of segments read by compaction task with more than 1 subtask.|
+| `segmentsPublished`| Number of segments published by compaction task with more than 1 subtask.|

Review Comment:
   Nit: The Druid docs generally avoid the extra spaces in tables:
   
   ```suggestion
   |Field|Description|
   |---|---|
   |`segmentsRead`|Number of segments read by compaction task with more than 1 subtask.|
   |`segmentsPublished`|Number of segments published by compaction task with more than 1 subtask.|
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   It is weird to have this as a top-level field in all of these classes when we already have a well-structured `TaskReport`. Ideally, this information should be present inside the `taskReport` map passed to this class and then later be extracted and processed in `ParallelIndexSupervisorTask` as needed.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/ParallelCompactionTaskReportData.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.indexing.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.indexer.IngestionState;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * This class has fields specific to the parallel compaction task and hence extends the generic
+ * task report data {@link IngestionStatsAndErrorsTaskReportData}
+ */
+public class ParallelCompactionTaskReportData extends IngestionStatsAndErrorsTaskReportData

Review Comment:
   Why do we need a new class for just 2 new fields?
   `segmentsPublished` and `segmentsRead` is information that can be useful in the case of non-compaction jobs too. We can use the existing `IngestionStatsAndErrorsTaskReportData` class and add these two as nullable fields.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on PR #15947:
URL: https://github.com/apache/druid/pull/15947#issuecomment-1978032525

   Here is the fix: https://github.com/apache/druid/pull/16042


-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on PR #15947:
URL: https://github.com/apache/druid/pull/15947#issuecomment-1977979914

   @suneet-s, the missing report you pointed out is actually related to change: #15981  I'll make up a follow up PR to address it.
   


-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512991162


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/ParallelCompactionTaskReportData.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.indexing.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.indexer.IngestionState;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * This class has fields specific to the parallel compaction task and hence extends the generic
+ * task report data {@link IngestionStatsAndErrorsTaskReportData}
+ */
+public class ParallelCompactionTaskReportData extends IngestionStatsAndErrorsTaskReportData

Review Comment:
   The way to do that would be to use the annotation `@JsonInclude(JsonInclude.Include.NON_NULL)` so that only non-null values get serialized.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1506663728


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -91,6 +108,7 @@ public String toString()
         "taskId='" + taskId + '\'' +
         ", partitionStats=" + partitionStats +
         ", taskReport=" + taskReport +
+           ", segmentsRead=" + segmentsRead +

Review Comment:
   ```suggestion
           ", segmentsRead=" + segmentsRead +
   ```



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512859727


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   The goal was to avoid adding unnecessary fields to the `IngestionStatsAndErrorReportData` where it would show up on reports everywhere



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1504730052


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -633,6 +635,14 @@ private TaskStatus runSinglePhaseParallel(TaskToolbox toolbox) throws Exception
     if (state.isSuccess()) {
       //noinspection ConstantConditions
       publishSegments(toolbox, parallelSinglePhaseRunner.getReports());
+      segmentsRead = parallelSinglePhaseRunner.getReports()
+                                              .values()
+                                              .stream()
+                                              .mapToInt(report -> report.getOldSegments().size()).sum();
+      segmentsRead = parallelSinglePhaseRunner.getReports()

Review Comment:
   ```suggestion
         segmentsPublished = parallelSinglePhaseRunner.getReports()
   ```



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512120594


##########
integration-tests/src/test/java/org/apache/druid/tests/indexer/ITCompactionTaskTest.java:
##########
@@ -220,6 +271,9 @@ private void loadDataAndCompact(
 
       Map<String, IngestionStatsAndErrorsTaskReport> reports = indexer.getTaskReport(taskId);
       Assert.assertTrue(reports != null && reports.size() > 0);
+
+      System.out.println(reports.size());
+      System.out.println(Arrays.toString(reports.values().stream().map(r -> r.toString()).toArray()));

Review Comment:
   yeah, this was my local testing.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512581388


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   It is weird to have `segmentsRead` as a top-level field in all of these classes when we already have the `TaskReport` objects that are being passed here. Ideally, this field should be present inside the `taskReport` map passed to this class (inside the corresponding `IngestionStatsAndErrorReportData` object and then later be extracted and processed in `ParallelIndexSupervisorTask` as needed.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512849219


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/ParallelCompactionTaskReportData.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.indexing.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.indexer.IngestionState;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * This class has fields specific to the parallel compaction task and hence extends the generic
+ * task report data {@link IngestionStatsAndErrorsTaskReportData}
+ */
+public class ParallelCompactionTaskReportData extends IngestionStatsAndErrorsTaskReportData

Review Comment:
   https://github.com/apache/druid/pull/15947#pullrequestreview-1909752276
   
   Basically to avoid confusion of being null where these fields still mean something but haven't got functionality yet to populate them.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "adithyachakilam (via GitHub)" <gi...@apache.org>.
adithyachakilam commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1504960237


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/IngestionStatsAndErrorsTaskReportData.java:
##########
@@ -57,7 +62,9 @@ public IngestionStatsAndErrorsTaskReportData(
       @JsonProperty("errorMsg") @Nullable String errorMsg,
       @JsonProperty("segmentAvailabilityConfirmed") boolean segmentAvailabilityConfirmed,
       @JsonProperty("segmentAvailabilityWaitTimeMs") long segmentAvailabilityWaitTimeMs,
-      @JsonProperty("recordsProcessed") Map<String, Long> recordsProcessed
+      @JsonProperty("recordsProcessed") Map<String, Long> recordsProcessed,
+      @JsonProperty("segmentsRead") int segmentsRead,

Review Comment:
   Done.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsMetadataReport.java:
##########
@@ -38,9 +38,10 @@ class GeneratedPartitionsMetadataReport extends GeneratedPartitionsReport
   GeneratedPartitionsMetadataReport(
       @JsonProperty("taskId") String taskId,
       @JsonProperty("partitionStats") List<PartitionStat> partitionStats,
-      @JsonProperty("taskReport") Map<String, TaskReport> taskReport
+      @JsonProperty("taskReport") Map<String, TaskReport> taskReport,
+      @JsonProperty("segmentsRead") Integer segmentsRead

Review Comment:
   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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "YongGang (via GitHub)" <gi...@apache.org>.
YongGang commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1504888115


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/IngestionStatsAndErrorsTaskReportData.java:
##########
@@ -57,7 +62,9 @@ public IngestionStatsAndErrorsTaskReportData(
       @JsonProperty("errorMsg") @Nullable String errorMsg,
       @JsonProperty("segmentAvailabilityConfirmed") boolean segmentAvailabilityConfirmed,
       @JsonProperty("segmentAvailabilityWaitTimeMs") long segmentAvailabilityWaitTimeMs,
-      @JsonProperty("recordsProcessed") Map<String, Long> recordsProcessed
+      @JsonProperty("recordsProcessed") Map<String, Long> recordsProcessed,
+      @JsonProperty("segmentsRead") int segmentsRead,

Review Comment:
   I think the data type for these two new fields should be `Long` (can be nullable). For tasks that don't read or publish segments these will be null value, if using 0 then hard to distinguish if task is really reading 0 segments (maybe due to some task failure) or this field is not applicable for the task type.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsMetadataReport.java:
##########
@@ -38,9 +38,10 @@ class GeneratedPartitionsMetadataReport extends GeneratedPartitionsReport
   GeneratedPartitionsMetadataReport(
       @JsonProperty("taskId") String taskId,
       @JsonProperty("partitionStats") List<PartitionStat> partitionStats,
-      @JsonProperty("taskReport") Map<String, TaskReport> taskReport
+      @JsonProperty("taskReport") Map<String, TaskReport> taskReport,
+      @JsonProperty("segmentsRead") Integer segmentsRead

Review Comment:
   `Long` type is more future proof and align with other numeric metric recorded.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512581388


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   It is weird to have this as a top-level field in all of these classes when we already have a `TaskReport`. Ideally, this information should be present inside the `taskReport` map passed to this class and then later be extracted and processed in `ParallelIndexSupervisorTask` as needed.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1513019985


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   Please refer to the comment above https://github.com/apache/druid/pull/15947#discussion_r1512991162



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1508115497


##########
docs/ingestion/tasks.md:
##########
@@ -103,6 +103,14 @@ For some task types, the indexing task can wait for the newly ingested segments
 |`segmentAvailabilityWaitTimeMs`|Milliseconds waited by the ingestion task for the newly ingested segments to be available for query after completing ingestion was completed.|
 |`recordsProcessed`| Partitions that were processed by an ingestion task and includes count of records processed from each partition.|
 
+
+#### Compaction Task Fields
+
+| Field               | Description                                  |
+|---------------------|----------------------------------------------|
+| `segmentsRead`      | # of segments read by a compaction task      |
+| `segmentsPublished` | # of segments published by a compaction task |

Review Comment:
   Can you add some commentary here that indicates these fields are only expected for compaction tasks that spawn 1 or more sub tasks



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "YongGang (via GitHub)" <gi...@apache.org>.
YongGang commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1506629498


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -91,6 +108,7 @@ public String toString()
         "taskId='" + taskId + '\'' +
         ", partitionStats=" + partitionStats +
         ", taskReport=" + taskReport +
+           ", segmentsRead=" + segmentsRead +

Review Comment:
   nit: can make the indentation more consistent



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1513624517


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1643,6 +1660,13 @@
             getBuildSegmentsStatsFromTaskReport(taskReport, true, unparseableEvents);
 
         buildSegmentsRowStats.addRowIngestionMetersTotals(rowStatsForCompletedTask);
+
+        Long segmentsRead = ((IngestionStatsAndErrorsTaskReport)
+            taskReport.get(IngestionStatsAndErrorsTaskReport.REPORT_KEY)
+        ).getPayload().getSegmentsRead();

Review Comment:
   ## Possible confusion of local and field
   
   Confusing name: method [doGetRowStatsAndUnparseableEventsParallelMultiPhase](1) also refers to field [segmentsRead](2) (without qualifying it with 'this').
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/6982)



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1512581388


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/GeneratedPartitionsReport.java:
##########
@@ -37,11 +38,19 @@ public class GeneratedPartitionsReport implements SubTaskReport
   private final List<PartitionStat> partitionStats;
   private final Map<String, TaskReport> taskReport;
 
-  GeneratedPartitionsReport(String taskId, List<PartitionStat> partitionStats, Map<String, TaskReport> taskReport)
+  private final Long segmentsRead;
+
+  GeneratedPartitionsReport(
+      String taskId,
+      List<PartitionStat> partitionStats,
+      Map<String, TaskReport> taskReport,
+      Long segmentsRead

Review Comment:
   It is weird to have `segmentsRead` as a top-level field in all of these classes when we already have the `TaskReport` objects that are being passed here. Ideally, this field should be present inside the `taskReport` map passed to this class (inside the corresponding `IngestionStatsAndErrorReportData` object) and then later be extracted and processed in `ParallelIndexSupervisorTask` as needed.



-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #15947:
URL: https://github.com/apache/druid/pull/15947


-- 
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


Re: [PR] Enable segments read/published stats on Compaction task completion reports (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #15947:
URL: https://github.com/apache/druid/pull/15947#discussion_r1514697656


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -920,7 +928,6 @@ TaskStatus runRangePartitionMultiPhaseParallel(TaskToolbox toolbox) throws Excep
     TaskState mergeState = runNextPhase(mergeRunner);
     TaskStatus taskStatus;
     if (mergeState.isSuccess()) {
-      publishSegments(toolbox, mergeRunner.getReports());

Review Comment:
   Why have we removed this line? Same comment in 2 other places.



-- 
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