Skip to content

Commit b582b47

Browse files
Reindex DashboardInfo
1 parent 49e0dc2 commit b582b47

File tree

4 files changed

+126
-0
lines changed

4 files changed

+126
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.linkedin.datahub.upgrade.config.restoreindices;
2+
3+
import com.linkedin.datahub.upgrade.config.SystemUpdateCondition;
4+
import com.linkedin.datahub.upgrade.system.NonBlockingSystemUpgrade;
5+
import com.linkedin.datahub.upgrade.system.restoreindices.dashboardinfo.ReindexDashboardInfo;
6+
import com.linkedin.metadata.entity.AspectDao;
7+
import com.linkedin.metadata.entity.EntityService;
8+
import io.datahubproject.metadata.context.OperationContext;
9+
import org.springframework.beans.factory.annotation.Value;
10+
import org.springframework.context.annotation.Bean;
11+
import org.springframework.context.annotation.Conditional;
12+
import org.springframework.context.annotation.Configuration;
13+
14+
@Configuration
15+
@Conditional(SystemUpdateCondition.NonBlockingSystemUpdateCondition.class)
16+
public class ReindexDashboardInfoConfig {
17+
18+
@Bean
19+
public NonBlockingSystemUpgrade reindexDashboardInfo(
20+
final OperationContext opContext,
21+
final EntityService<?> entityService,
22+
final AspectDao aspectDao,
23+
@Value("${systemUpdate.dashboardInfo.enabled}") final boolean enabled,
24+
@Value("${systemUpdate.dashboardInfo.batchSize}") final Integer batchSize,
25+
@Value("${systemUpdate.dashboardInfo.delayMs}") final Integer delayMs,
26+
@Value("${systemUpdate.dashboardInfo.limit}") final Integer limit) {
27+
return new ReindexDashboardInfo(
28+
opContext, entityService, aspectDao, enabled, batchSize, delayMs, limit);
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.linkedin.datahub.upgrade.system.restoreindices.dashboardinfo;
2+
3+
import com.google.common.collect.ImmutableList;
4+
import com.linkedin.datahub.upgrade.UpgradeStep;
5+
import com.linkedin.datahub.upgrade.system.NonBlockingSystemUpgrade;
6+
import com.linkedin.metadata.entity.AspectDao;
7+
import com.linkedin.metadata.entity.EntityService;
8+
import io.datahubproject.metadata.context.OperationContext;
9+
import java.util.List;
10+
import javax.annotation.Nonnull;
11+
import lombok.extern.slf4j.Slf4j;
12+
13+
/**
14+
* A job that reindexes all dashboard info aspects as part of reindexing dashboards relationship.
15+
* This is required to fix the dashboards relationships for dashboards
16+
*/
17+
@Slf4j
18+
public class ReindexDashboardInfo implements NonBlockingSystemUpgrade {
19+
20+
private final List<UpgradeStep> _steps;
21+
22+
public ReindexDashboardInfo(
23+
@Nonnull OperationContext opContext,
24+
EntityService<?> entityService,
25+
AspectDao aspectDao,
26+
boolean enabled,
27+
Integer batchSize,
28+
Integer batchDelayMs,
29+
Integer limit) {
30+
if (enabled) {
31+
_steps =
32+
ImmutableList.of(
33+
new ReindexDashboardInfoStep(
34+
opContext, entityService, aspectDao, batchSize, batchDelayMs, limit));
35+
} else {
36+
_steps = ImmutableList.of();
37+
}
38+
}
39+
40+
@Override
41+
public String id() {
42+
return this.getClass().getName();
43+
}
44+
45+
@Override
46+
public List<UpgradeStep> steps() {
47+
return _steps;
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.linkedin.datahub.upgrade.system.restoreindices.dashboardinfo;
2+
3+
import static com.linkedin.metadata.Constants.*;
4+
5+
import com.linkedin.datahub.upgrade.system.AbstractMCLStep;
6+
import com.linkedin.metadata.entity.AspectDao;
7+
import com.linkedin.metadata.entity.EntityService;
8+
import io.datahubproject.metadata.context.OperationContext;
9+
import javax.annotation.Nonnull;
10+
import lombok.extern.slf4j.Slf4j;
11+
import org.jetbrains.annotations.Nullable;
12+
13+
@Slf4j
14+
public class ReindexDashboardInfoStep extends AbstractMCLStep {
15+
16+
public ReindexDashboardInfoStep(
17+
OperationContext opContext,
18+
EntityService<?> entityService,
19+
AspectDao aspectDao,
20+
Integer batchSize,
21+
Integer batchDelayMs,
22+
Integer limit) {
23+
super(opContext, entityService, aspectDao, batchSize, batchDelayMs, limit);
24+
}
25+
26+
@Override
27+
public String id() {
28+
return "dashboard-info-v1";
29+
}
30+
31+
@Nonnull
32+
@Override
33+
protected String getAspectName() {
34+
return DASHBOARD_INFO_ASPECT_NAME;
35+
}
36+
37+
@Nullable
38+
@Override
39+
protected String getUrnLike() {
40+
return "urn:li:" + DASHBOARD_ENTITY_NAME + ":%";
41+
}
42+
}

metadata-service/configuration/src/main/resources/application.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@ systemUpdate:
403403
batchSize: ${BOOTSTRAP_SYSTEM_UPDATE_DOMAIN_DESCRIPTION_BATCH_SIZE:1000}
404404
delayMs: ${BOOTSTRAP_SYSTEM_UPDATE_DOMAIN_DESCRIPTION_DELAY_MS:30000}
405405
limit: ${BOOTSTRAP_SYSTEM_UPDATE_DOMAIN_DESCRIPTION_CLL_LIMIT:0}
406+
dashboardInfo:
407+
enabled: ${BOOTSTRAP_SYSTEM_UPDATE_DASHBOARD_INFO_ENABLED:true}
408+
batchSize: ${BOOTSTRAP_SYSTEM_UPDATE_DASHBOARD_INFO_BATCH_SIZE:1000}
409+
delayMs: ${BOOTSTRAP_SYSTEM_UPDATE_DASHBOARD_INFO_DELAY_MS:30000}
410+
limit: ${BOOTSTRAP_SYSTEM_UPDATE_DASHBOARD_INFO_CLL_LIMIT:0}
406411
browsePathsV2:
407412
enabled: ${BOOTSTRAP_SYSTEM_UPDATE_BROWSE_PATHS_V2_ENABLED:true}
408413
batchSize: ${BOOTSTRAP_SYSTEM_UPDATE_BROWSE_PATHS_V2_BATCH_SIZE:5000}

0 commit comments

Comments
 (0)