Skip to content

Commit

Permalink
fix(nocode): fix DeleteLegacyGraphRelationshipsStep for Elasticsearch (
Browse files Browse the repository at this point in the history
…#8181)

Co-authored-by: Pedro Silva <[email protected]>
  • Loading branch information
david-leifker and pedro93 authored Jun 7, 2023
1 parent 9ca8218 commit 22e7771
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import com.linkedin.datahub.upgrade.impl.DefaultUpgradeStepResult;
import com.linkedin.metadata.graph.GraphService;
import com.linkedin.metadata.graph.neo4j.Neo4jGraphService;
import lombok.extern.slf4j.Slf4j;

import java.util.function.Function;


// Do we need SQL-tech specific migration paths?
@Slf4j
public class DeleteLegacyGraphRelationshipsStep implements UpgradeStep {

private final String deletePattern = "com.linkedin.*";
Expand All @@ -34,7 +37,11 @@ public int retryCount() {
public Function<UpgradeContext, UpgradeStepResult> executable() {
return (context) -> {
try {
((Neo4jGraphService) _graphClient).removeNodesMatchingLabel(deletePattern);
if (_graphClient instanceof Neo4jGraphService) {
((Neo4jGraphService) _graphClient).removeNodesMatchingLabel(deletePattern);
} else {
log.info("Skipping DeleteLegacyGraphRelationshipsStep for non-neo4j graphClient.");
}
} catch (Exception e) {
context.report().addLine("Failed to delete legacy data from graph", e);
return new DefaultUpgradeStepResult(
Expand Down

0 comments on commit 22e7771

Please sign in to comment.