You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kfaraz (via GitHub)" <gi...@apache.org> on 2024/03/26 09:28:57 UTC
[PR] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
kfaraz opened a new pull request, #16202:
URL: https://github.com/apache/druid/pull/16202
### Changes
- No functional changes
- Add method `AbstractBatchIndexTask.buildIngestionStatsReport()` used in several batch tasks
- Add utility method `AbstractBatchIndexTask.addBuildSegmentStatsToReport()`
- Rename `IngestionStatsAndErrorsTaskReportData` to `IngestionStatsAndErrors`
- Clean up some of the methods
--
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] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16202:
URL: https://github.com/apache/druid/pull/16202#issuecomment-2024676941
@abhishekrb19 , I have done some further cleanup in `IndexTaskTest` and added some tests to address the coverage. These tests are not super helpful right now. I am essentially just invoking the methods `getRowStats` and `getLiveReports` but not verifying the returned values. I plan to do this and address some of your remaining cleanup suggestions in a follow up PR.
--
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] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #16202:
URL: https://github.com/apache/druid/pull/16202
--
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] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16202:
URL: https://github.com/apache/druid/pull/16202#issuecomment-2021827617
Thanks for the review, @abhishekrb19 ! I will try adding the suggested tests today.
--
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] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 commented on code in PR #16202:
URL: https://github.com/apache/druid/pull/16202#discussion_r1540337797
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1612,8 +1607,10 @@ private Pair<Map<String, Object>, Map<String, Object>> doGetRowStatsAndUnparseab
LOG.warn("Got an empty task report from subtask: " + pushedSegmentsReport.getTaskId());
Review Comment:
```suggestion
LOG.warn("Received an empty report from subtask[%s]" + pushedSegmentsReport.getTaskId());
```
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java:
##########
@@ -463,7 +421,7 @@ public Response getLiveReports(
payload.put("ingestionState", ingestionState);
payload.put("unparseableEvents", events);
- payload.put("rowStats", doGetRowStats(full));
+ payload.put("rowStats", doGetRowStats(full != null));
Review Comment:
Ditto for the API `/liveReports` API. It seems relatively straightforward to add a unit test for `getUnparseableEvents()`.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java:
##########
@@ -335,34 +333,14 @@ public Response getUnparseableEvents(
)
Review Comment:
It seems like there's no existing unit test for the `unparseableEvents` API. I think adding a UT for this function with no `full` query param should help with the test code coverage and also cover the new boolean logic.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java:
##########
@@ -382,33 +360,13 @@ public Map<String, Object> doGetUnparseableEvents(String full)
return events;
}
- public Map<String, Object> doGetRowStats(String full)
+ public Map<String, Object> doGetRowStats(boolean isFullReport)
{
Map<String, Object> returnMap = new HashMap<>();
Map<String, Object> totalsMap = new HashMap<>();
Map<String, Object> averagesMap = new HashMap<>();
- boolean needsDeterminePartitions = false;
- boolean needsBuildSegments = false;
-
- if (full != null) {
- needsDeterminePartitions = true;
- needsBuildSegments = true;
- } else {
- switch (ingestionState) {
- case DETERMINE_PARTITIONS:
- needsDeterminePartitions = true;
- break;
Review Comment:
Good cleanup of this switch block. I have seen versions of it thrice already
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1800,25 +1800,25 @@ public Response getRowStats(
)
{
IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper);
- return Response.ok(doGetRowStatsAndUnparseableEvents(full, false).lhs).build();
+ return Response.ok(doGetRowStatsAndUnparseableEvents(full != null, false).lhs).build();
}
@VisibleForTesting
Review Comment:
I think we can remove this test hook and directly call the API methods. It would help cleaning up the code a bit and also provide more test coverage that CI is complaining about. It would need passing in an additional mocked request object from the callers.
--
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] Refactor: Add common method in AbstractBatchIndexTask to create ingestion stats report (druid)
Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 commented on code in PR #16202:
URL: https://github.com/apache/druid/pull/16202#discussion_r1543345106
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/IngestionStatsAndErrors.java:
##########
@@ -29,32 +29,15 @@
public class IngestionStatsAndErrors
{
- @JsonProperty
- private IngestionState ingestionState;
-
- @JsonProperty
- private Map<String, Object> unparseableEvents;
-
- @JsonProperty
- private Map<String, Object> rowStats;
-
- @JsonProperty
- @Nullable
- private String errorMsg;
-
- @JsonProperty
- private boolean segmentAvailabilityConfirmed;
-
- @JsonProperty
- private long segmentAvailabilityWaitTimeMs;
-
- @JsonProperty
- private Map<String, Long> recordsProcessed;
-
- @JsonProperty
- private Long segmentsRead;
- @JsonProperty
- private Long segmentsPublished;
+ private final IngestionState ingestionState;
+ private final Map<String, Object> unparseableEvents;
+ private final Map<String, Object> rowStats;
+ private final String errorMsg;
+ private final boolean segmentAvailabilityConfirmed;
+ private final long segmentAvailabilityWaitTimeMs;
+ private final Map<String, Long> recordsProcessed;
Review Comment:
Neat 👍
--
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