Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to have a common interface for InUpdate Callback #451

Merged
merged 12 commits into from
Oct 17, 2024

Conversation

rakhiagr
Copy link
Contributor

@rakhiagr rakhiagr commented Oct 16, 2024

Summary

For this pull request, we have refactored the codebase to have a common interface for InUpdate Callback. This interface can be used for both Restli implementation (DatasetAccountableOwnership aspect) and gRPC implementations (Asset classes). Refactored the callback operation from the top of stack add method to the bottom most updateAspectHelper method to leverage the transactions and retry mechanism.

We still need the rawAdd method to skip the callbacks(routing) for cases where the ingestion request is routed to a client and comes back for ingestion to local DAO (Known case: AccountableOwnership uses rawAdd for dual write).

Testing Done

mint build
Unit tests added

Checklist

@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 10 lines in your changes missing coverage. Please review.

Project coverage is 67.52%. Comparing base (a4f22cc) to head (5dccaea).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...n/java/com/linkedin/metadata/dao/BaseLocalDAO.java 70.00% 6 Missing and 3 partials ⚠️
...metadata/dao/ingestion/AspectCallbackResponse.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #451      +/-   ##
============================================
- Coverage     67.59%   67.52%   -0.07%     
- Complexity     1572     1581       +9     
============================================
  Files           142      142              
  Lines          6125     6159      +34     
  Branches        660      667       +7     
============================================
+ Hits           4140     4159      +19     
- Misses         1706     1717      +11     
- Partials        279      283       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

*/
@Data
public class PreUpdateResponse<ASPECT extends RecordTemplate> {
public class InUpdateResponse<ASPECT extends RecordTemplate> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this Response class here instead of just return aspect? Are we planning to add more field in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. For SourceLineage Ingestion Hook, MM team needs Auditstamp as part of response as well. More details: https://docs.google.com/document/d/1PlPPb4gHJYCViH9pcuwChVoiJDcmll-_1yREvoG3iCI/edit

@rakhiagr rakhiagr changed the title Refactor to InUpdate Refactor to have a common interface for InUpdate Callback Oct 16, 2024
@@ -610,7 +618,7 @@ public List<ASPECT_UNION> addMany(@Nonnull URN urn, @Nonnull List<? extends Reco
}

private <ASPECT extends RecordTemplate> AddResult<ASPECT> aspectUpdateHelper(URN urn, AspectUpdateLambda<ASPECT> updateTuple,
@Nonnull AuditStamp auditStamp, @Nullable IngestionTrackingContext trackingContext) {
@Nonnull AuditStamp auditStamp, @Nullable IngestionTrackingContext trackingContext, boolean inSkipUpdate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isRawUpdate?

@@ -831,8 +846,8 @@ public <ASPECT extends RecordTemplate> ASPECT add(@Nonnull URN urn, @Nonnull Cla
@Nonnull
public <ASPECT extends RecordTemplate> ASPECT add(@Nonnull URN urn, @Nonnull Class<ASPECT> aspectClass,
@Nonnull Function<Optional<ASPECT>, ASPECT> updateLambda, @Nonnull AuditStamp auditStamp,
@Nullable IngestionTrackingContext trackingContext, @Nonnull IngestionParams ingestionParams) {
return add(urn, aspectClass, updateLambda, auditStamp, DEFAULT_MAX_TRANSACTION_RETRY, trackingContext, ingestionParams);
@Nullable IngestionTrackingContext trackingContext, @Nonnull IngestionParams ingestionParams, boolean inSkipUpdate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, I hope raw update is the only place where we will set the flag to be true

Copy link
Contributor

@ZihanLi58 ZihanLi58 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jsdonn jsdonn left a comment

Choose a reason for hiding this comment

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

Please test the rawIngest case still works with this refactor

@rakhiagr rakhiagr merged commit cf1e5ee into master Oct 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants