Skip to content

Fix OverlordClient to read reports as a concrete ReportMap object instead of a generic map#16226

Merged
kfaraz merged 33 commits intoapache:masterfrom
kfaraz:read_report_from_ol_client
Apr 15, 2024
Merged

Fix OverlordClient to read reports as a concrete ReportMap object instead of a generic map#16226
kfaraz merged 33 commits intoapache:masterfrom
kfaraz:read_report_from_ol_client

Conversation

@kfaraz
Copy link
Copy Markdown
Contributor

@kfaraz kfaraz commented Apr 2, 2024

Follow up to #16217

Changes

  • Update OverlordClient.getReportAsMap() to return TaskReport.ReportMap
  • Move the following classes to org.apache.druid.indexer.report in the druid-processing module
    • TaskReport
    • KillTaskReport
    • IngestionStatsAndErrorsTaskReport
    • TaskContextReport
    • TaskReportFileWriter
    • SingleFileTaskReportFileWriter
    • TaskReportSerdeTest
  • Remove MsqOverlordResourceTestClient as it had only one unique which is already present in OverlordResourceTestClient itself

This PR has:

  • been self-reviewed.
  • 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
  • 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 is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions Bot added Area - Batch Ingestion Area - Querying Area - Streaming Ingestion Area - Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Apr 2, 2024
@kfaraz kfaraz requested review from abhishekrb19 and cryptoe April 8, 2024 05:20
= report.findReport(IngestionStatsAndErrorsTaskReport.REPORT_KEY);

final IngestionStatsAndErrors payload;
if (ingestionStatsReport.isPresent()) {
Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI checks are failing because of insufficient branch and line coverage for this code.

@abhishekrb19
Copy link
Copy Markdown
Contributor

The changes look good to me overall! Just needs CI checks to pass and conflicts resolved. Also, did you intend to add more tests in this patch as noted "pending" in the PR description?

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Apr 10, 2024

The changes look good to me overall! Just needs CI checks to pass and conflicts resolved. Also, did you intend to add more tests in this patch as noted "pending" in the PR description?

Added tests to verify report of running tasks.

@kfaraz kfaraz requested a review from abhishekrb19 April 10, 2024 11:51
Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kfaraz thanks for the patch! I have left some minor suggestion. +1 after CI checks. Also, if it's feasible to address the insufficient line coverage error, that'd be great

Comment on lines +738 to +739
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for readability

Suggested change
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId));
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId)
);

Comment on lines +749 to +750
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId));
MSQTaskReportPayload msqTaskReportPayload = SqlStatementResourceHelper.getPayload(
contactOverlord(overlordClient.taskReportAsMap(queryId), queryId)
);

}
return (Map<String, Object>) map.get(key);

com.google.common.base.Optional<MSQTaskReport> report = reportMap.findReport("multiStageQuery");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an observation: it's slightly weird that we have Optional usages from both guava and java.util packages in the same class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

getIndexingServiceClient().runTask(task.getId(), task);

// Allow enough time for sub-tasks to be in running state
Thread.sleep(2000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose adding a latch or a similar mechanism for testing would make it more involved?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it felt like overkill right now. I plan to revisit these indexing tests at some point in the near future.


@Override
public ListenableFuture<Map<String, Object>> taskReportAsMap(String taskId)
public ListenableFuture<TaskReport.ReportMap> taskReportAsMap(String taskId)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding a simple serde test that verifies that the old and new objects being returned roundtrip fine for compatibility reasons (similar to this comment #16217 (comment)).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@kfaraz kfaraz merged commit 81d7b6e into apache:master Apr 15, 2024
@kfaraz kfaraz deleted the read_report_from_ol_client branch April 15, 2024 02:31
@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Apr 15, 2024

Thanks a lot for the review, @abhishekrb19 !

@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Area - Querying Area - Streaming Ingestion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants