-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(analytics): index description so analytics are correct (#11224)
- Loading branch information
1 parent
beb4306
commit 8479d2f
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...ade/src/main/java/com/linkedin/datahub/upgrade/config/ReindexDomainDescriptionConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.linkedin.datahub.upgrade.config; | ||
|
||
import com.linkedin.datahub.upgrade.system.NonBlockingSystemUpgrade; | ||
import com.linkedin.datahub.upgrade.system.domaindescription.ReindexDomainDescription; | ||
import com.linkedin.metadata.entity.AspectDao; | ||
import com.linkedin.metadata.entity.EntityService; | ||
import io.datahubproject.metadata.context.OperationContext; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Conditional; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@Conditional(SystemUpdateCondition.NonBlockingSystemUpdateCondition.class) | ||
public class ReindexDomainDescriptionConfig { | ||
|
||
@Bean | ||
public NonBlockingSystemUpgrade reindexDomainDescription( | ||
final OperationContext opContext, | ||
final EntityService<?> entityService, | ||
final AspectDao aspectDao, | ||
@Value("${systemUpdate.domainDescription.enabled}") final boolean enabled, | ||
@Value("${systemUpdate.domainDescription.batchSize}") final Integer batchSize, | ||
@Value("${systemUpdate.domainDescription.delayMs}") final Integer delayMs, | ||
@Value("${systemUpdate.domainDescription.limit}") final Integer limit) { | ||
return new ReindexDomainDescription( | ||
opContext, entityService, aspectDao, enabled, batchSize, delayMs, limit); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
.../java/com/linkedin/datahub/upgrade/system/domaindescription/ReindexDomainDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.linkedin.datahub.upgrade.system.domaindescription; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.linkedin.datahub.upgrade.UpgradeStep; | ||
import com.linkedin.datahub.upgrade.system.NonBlockingSystemUpgrade; | ||
import com.linkedin.metadata.entity.AspectDao; | ||
import com.linkedin.metadata.entity.EntityService; | ||
import io.datahubproject.metadata.context.OperationContext; | ||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* A job that reindexes all domain aspects as part of reindexing descriptions This is required to | ||
* fix the analytics for domains | ||
*/ | ||
@Slf4j | ||
public class ReindexDomainDescription implements NonBlockingSystemUpgrade { | ||
|
||
private final List<UpgradeStep> _steps; | ||
|
||
public ReindexDomainDescription( | ||
@Nonnull OperationContext opContext, | ||
EntityService<?> entityService, | ||
AspectDao aspectDao, | ||
boolean enabled, | ||
Integer batchSize, | ||
Integer batchDelayMs, | ||
Integer limit) { | ||
if (enabled) { | ||
_steps = | ||
ImmutableList.of( | ||
new ReindexDomainDescriptionStep( | ||
opContext, entityService, aspectDao, batchSize, batchDelayMs, limit)); | ||
} else { | ||
_steps = ImmutableList.of(); | ||
} | ||
} | ||
|
||
@Override | ||
public String id() { | ||
return this.getClass().getName(); | ||
} | ||
|
||
@Override | ||
public List<UpgradeStep> steps() { | ||
return _steps; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...a/com/linkedin/datahub/upgrade/system/domaindescription/ReindexDomainDescriptionStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.linkedin.datahub.upgrade.system.domaindescription; | ||
|
||
import static com.linkedin.metadata.Constants.*; | ||
|
||
import com.linkedin.datahub.upgrade.system.AbstractMCLStep; | ||
import com.linkedin.metadata.entity.AspectDao; | ||
import com.linkedin.metadata.entity.EntityService; | ||
import io.datahubproject.metadata.context.OperationContext; | ||
import javax.annotation.Nonnull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Slf4j | ||
public class ReindexDomainDescriptionStep extends AbstractMCLStep { | ||
|
||
public ReindexDomainDescriptionStep( | ||
OperationContext opContext, | ||
EntityService<?> entityService, | ||
AspectDao aspectDao, | ||
Integer batchSize, | ||
Integer batchDelayMs, | ||
Integer limit) { | ||
super(opContext, entityService, aspectDao, batchSize, batchDelayMs, limit); | ||
} | ||
|
||
@Override | ||
public String id() { | ||
return "domain-description-v1"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
protected String getAspectName() { | ||
return DOMAIN_PROPERTIES_ASPECT_NAME; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
protected String getUrnLike() { | ||
return "urn:li:" + DOMAIN_ENTITY_NAME + ":%"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters