-
Notifications
You must be signed in to change notification settings - Fork 58
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
Conversation
Codecov ReportAttention: Patch coverage is
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. |
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
*/ | ||
@Data | ||
public class PreUpdateResponse<ASPECT extends RecordTemplate> { | ||
public class InUpdateResponse<ASPECT extends RecordTemplate> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
restli-resources/src/main/java/com/linkedin/metadata/restli/BaseEntityResource.java
Outdated
Show resolved
Hide resolved
restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java
Outdated
Show resolved
Hide resolved
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
@@ -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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
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