Skip to content

Commit f6dde2b

Browse files
fix(restoreIndices): fix bug in urn paginated restoreIndices exit code (datahub-project#11443)
1 parent b607a66 commit f6dde2b

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

datahub-upgrade/build.gradle

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,34 @@ task run(type: Exec) {
121121
"-Dserver.port=8083", bootJar.getArchiveFile().get(), "-u", "SystemUpdate"
122122
}
123123

124+
/**
125+
* Runs RestoreIndices on locally running system. The batchSize are set to
126+
* test the process with pagination and not designed for optimal performance.
127+
*/
128+
task runRestoreIndices(type: Exec) {
129+
dependsOn bootJar
130+
group = "Execution"
131+
description = "Run the restore indices process locally."
132+
environment "ENTITY_REGISTRY_CONFIG_PATH", "../metadata-models/src/main/resources/entity-registry.yml"
133+
commandLine "java", "-agentlib:jdwp=transport=dt_socket,address=5003,server=y,suspend=n",
134+
"-jar",
135+
"-Dkafka.schemaRegistry.url=http://localhost:8080/schema-registry/api",
136+
"-Dserver.port=8083",
137+
bootJar.getArchiveFile().get(), "-u", "RestoreIndices", "-a", "batchSize=100"
138+
}
139+
140+
task runRestoreIndicesUrn(type: Exec) {
141+
dependsOn bootJar
142+
group = "Execution"
143+
description = "Run the restore indices process locally."
144+
environment "ENTITY_REGISTRY_CONFIG_PATH", "../metadata-models/src/main/resources/entity-registry.yml"
145+
commandLine "java", "-agentlib:jdwp=transport=dt_socket,address=5003,server=y,suspend=n",
146+
"-jar",
147+
"-Dkafka.schemaRegistry.url=http://localhost:8080/schema-registry/api",
148+
"-Dserver.port=8083",
149+
bootJar.getArchiveFile().get(), "-u", "RestoreIndices", "-a", "batchSize=100", "-a", "urnBasedPagination=true"
150+
}
151+
124152
docker {
125153
name "${docker_registry}/${docker_repo}:v${version}"
126154
version "v${version}"

datahub-upgrade/src/main/java/com/linkedin/datahub/upgrade/restoreindices/SendMAEStep.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.ArrayList;
1717
import java.util.List;
1818
import java.util.Map;
19+
import java.util.NoSuchElementException;
1920
import java.util.Optional;
2021
import java.util.concurrent.Callable;
2122
import java.util.concurrent.ExecutionException;
@@ -189,7 +190,12 @@ public Function<UpgradeContext, UpgradeStepResult> executable() {
189190
context.report().addLine(String.format("Rows processed this loop %d", rowsProcessed));
190191
start += args.batchSize;
191192
} catch (InterruptedException | ExecutionException e) {
192-
return new DefaultUpgradeStepResult(id(), DataHubUpgradeState.FAILED);
193+
if (e.getCause() instanceof NoSuchElementException) {
194+
context.report().addLine("End of data.");
195+
break;
196+
} else {
197+
return new DefaultUpgradeStepResult(id(), DataHubUpgradeState.FAILED);
198+
}
193199
}
194200
}
195201
} else {

0 commit comments

Comments
 (0)