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

fix(views): Add relationship annotation to GlobalViewsSettings urn #10597

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ record GlobalViewsSettings {
/**
* The default View for the instance, or organization.
*/
@Relationship = {
"name": "viewedWith",
"entityTypes": [ "dataHubView" ]
}
defaultView: optional Urn
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import com.linkedin.metadata.entity.AspectUtils;
import com.linkedin.metadata.key.DataHubViewKey;
import com.linkedin.metadata.utils.EntityKeyUtils;
import com.linkedin.r2.RemoteInvocationException;
import com.linkedin.view.DataHubViewDefinition;
import com.linkedin.view.DataHubViewInfo;
import com.linkedin.view.DataHubViewType;
import io.datahubproject.metadata.context.OperationContext;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -177,6 +179,20 @@ public void deleteView(@Nonnull OperationContext opContext, @Nonnull Urn viewUrn
try {
this.entityClient.deleteEntity(
opContext, Objects.requireNonNull(viewUrn, "viewUrn must not be null"));

// Asynchronously delete all references to the entity (to return quickly)
CompletableFuture.runAsync(
() -> {
try {
this.entityClient.deleteEntityReferences(opContext, viewUrn);
} catch (RemoteInvocationException e) {
log.error(
String.format(
"Caught exception while attempting to clear all entity references for view with urn %s",
viewUrn),
e);
}
});
} catch (Exception e) {
throw new RuntimeException(String.format("Failed to delete View with urn %s", viewUrn), e);
}
Expand Down
Loading