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

feat: Support deletion in EbeanGenericLocalDAO and BaseEntityAgnosticAspectResource #454

Merged
merged 6 commits into from
Oct 23, 2024

Conversation

JiaoMaWHU
Copy link
Contributor

@JiaoMaWHU JiaoMaWHU commented Oct 19, 2024

Summary

Support deletion in EbeanGenericLocalDAO and BaseEntityAgnosticAspectResource

We need to have generic deletion support for annotation metadata.

Long-term wise, team decided to have deletion support in every grpc endpoint.

However, to meet the timeline of the annotation use case, a delete method will be added in the BaseEntityAgnosticAspectResource so that annotationGms resource can expose this action.

Details

  • added a delete method and not send MAE for updates
  • update queryLatest and backfill methods to accommodate deleted data

Testing Done

  • unit test added
  • ./gradlew build

Checklist

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2024

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.

Project coverage is 67.69%. Comparing base (cf1e5ee) to head (471707d).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...adata/restli/BaseEntityAgnosticAspectResource.java 50.00% 4 Missing ⚠️
...om/linkedin/metadata/dao/EbeanGenericLocalDAO.java 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #454      +/-   ##
============================================
+ Coverage     67.52%   67.69%   +0.16%     
- Complexity     1581     1606      +25     
============================================
  Files           142      143       +1     
  Lines          6159     6200      +41     
  Branches        667      675       +8     
============================================
+ Hits           4159     4197      +38     
- Misses         1717     1719       +2     
- Partials        283      284       +1     

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

@JiaoMaWHU JiaoMaWHU changed the title initial commit feat: Support deletion in EbeanGenericLocalDAO and BaseEntityAgnosticAspectResource Oct 22, 2024
@JiaoMaWHU JiaoMaWHU requested a review from zhixuanjia October 22, 2024 05:52
@JiaoMaWHU JiaoMaWHU marked this pull request as ready for review October 22, 2024 06:01
Comment on lines 106 to 109
if (shouldSkipMAEUpdate(newValue)) {
return null;
}
_producer.produceAspectSpecificMetadataAuditEvent(urn, null, newValue, auditStamp, trackingContext, ingestionMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

how about

if (!shouldSkipMAEUpdate(newValue)) {
  _producer.produceAspectSpecificMetadataAuditEvent(urn, null, newValue, auditStamp, trackingContext, ingestionMode);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sg

Comment on lines 129 to 132
if (shouldSkipMAEUpdate(newValue)) {
return null;
}
_producer.produceAspectSpecificMetadataAuditEvent(urn, currentValue, newValue, auditStamp, trackingContext, ingestionMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

?

if (!shouldSkipMAEUpdate(newValue)) {
  _producer.produceAspectSpecificMetadataAuditEvent(urn, currentValue, newValue, auditStamp, trackingContext, ingestionMode);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sg

@@ -128,7 +152,7 @@ public Optional<GenericLocalDAO.MetadataWithExtraInfo> queryLatest(@Nonnull Urn
final PrimaryKey key = new PrimaryKey(urn.toString(), aspectName, LATEST_VERSION);
EbeanMetadataAspect metadata = _server.find(EbeanMetadataAspect.class, key);

if (metadata == null || metadata.getMetadata() == null) {
if (metadata == null || metadata.getMetadata() == null || DELETED_VALUE.equals(metadata.getMetadata())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

so just to confirm the metadata will be set to DELETED_VALUE in mysql db?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JiaoMaWHU JiaoMaWHU merged commit b762dac into master Oct 23, 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.

3 participants