Skip to content

Commit 54fdd0e

Browse files
authored
CopySpacePost: decrease skipCount threshold 50k (#1812)
* CopySpacePost: decrease skipCount threshold 50k Signed-off-by: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com> * startTask: withRetryableErrorCodes Signed-off-by: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com> * rm unused import Signed-off-by: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com> --------- Signed-off-by: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com>
1 parent a37c164 commit 54fdd0e

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/compiler/SpaceCopy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,18 @@ public static CompilationStepGraph compile(String jobId, DatasetDescription.Spac
160160
outputMetadata = Map.of(target.getClass().getSimpleName().toLowerCase(), targetSpaceId);
161161

162162
long DROPCREATEINDEX_THRESHOLD = 4_000_000;
163-
boolean skipCountStatistics = sourceFeatureCount >= DROPCREATEINDEX_THRESHOLD;
163+
long SKIPCOUNT_THRESHOLD = 50_000;
164164

165165
CopySpacePost postCopySpace = new CopySpacePost()
166166
.withSpaceId(targetSpaceId)
167167
.withJobId(jobId)
168168
.withOutputMetadata(outputMetadata)
169169
.withInputSets(List.of(new InputSet(nextSpaceVersion.getOutputSet(VERSION))))
170-
.withSkipCounts( skipCountStatistics );
170+
.withSkipCounts( sourceFeatureCount >= SKIPCOUNT_THRESHOLD );
171171

172172
startGraph.addExecution(postCopySpace);
173173

174-
boolean useDropIndexOptimization = skipCountStatistics
174+
boolean useDropIndexOptimization = sourceFeatureCount >= DROPCREATEINDEX_THRESHOLD
175175
// target is empty and no filtering
176176
&& targetFeatureCount <= 0
177177
&& filters == null;

xyz-jobs/xyz-job-steps/src/main/java/com/here/xyz/jobs/steps/impl/transport/TaskedSpaceBasedStep.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ private void startTask(TaskProgress<I> taskProgressAndItem) throws TooManyResour
440440
//We can`t use the default callback here because we are reporting success during onAsyncUpdate in Java.
441441
//The failureCallback is still needed to report failures from the DB-side
442442
String failureCallback = buildFailureCallbackQuery().substitute().text().replaceAll("'", "''");
443-
runReadQueryAsync(buildTaskQuery(taskProgressAndItem.getTaskId(), (I) taskProgressAndItem.getTaskInput(), failureCallback),
443+
runReadQueryAsync(buildTaskQuery(taskProgressAndItem.getTaskId(), (I) taskProgressAndItem.getTaskInput(), failureCallback)
444+
.withRetryableErrorCodes(RETRYABLE_SQL_CODES),
444445
queryRunsOnWriter() ? dbWriter() : dbReader(), 0d/*perItemAcus.doubleValue()*/, false);
445446
}
446447
}
@@ -708,7 +709,7 @@ private TaskProgress getTaskProgress() throws WebClientException, SQLException,
708709
}
709710

710711
private static SQLQuery buildTaskTableStatement(String schema, Step step) {
711-
return new SQLQuery("""
712+
return new SQLQuery("""
712713
CREATE TABLE ${schema}.${table}
713714
(
714715
task_id SERIAL,
@@ -727,7 +728,7 @@ private static SQLQuery buildTaskTableStatement(String schema, Step step) {
727728

728729
private SQLQuery resetTaskItemWhichAreNotFinalized(String schema, String stepId) {
729730
infoLog(STEP_EXECUTE, "Reset task items for restart.");
730-
return new SQLQuery("""
731+
return new SQLQuery("""
731732
UPDATE ${schema}.${table} t
732733
SET started = false
733734
WHERE started = true AND finalized = false;
@@ -804,7 +805,7 @@ private boolean insertTaskItemsInTaskTable(String schema, Step step, List<I> tas
804805
for (I taskInput : taskInputs) {
805806
String taskItem = taskInput.serialize();
806807

807-
insertQueries.add(new SQLQuery("""
808+
insertQueries.add(new SQLQuery("""
808809
INSERT INTO ${schema}.${table} AS t (task_input)
809810
VALUES (#{taskItem}::JSONB);
810811
""")

0 commit comments

Comments
 (0)