Skip to content

Commit

Permalink
Fix two bugs which have happened during job-deletions.
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Chrzan <[email protected]>
Signed-off-by: mchrza <[email protected]>
  • Loading branch information
mchrza committed Oct 11, 2024
1 parent aa7cf22 commit 7fc114e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private static <T extends Input> List<T> loadInputsAndWriteMetadata(String jobId
return inputs;
}

static final InputsMetadata loadMetadata(String jobId) throws IOException {
static final InputsMetadata loadMetadata(String jobId) throws IOException, AmazonS3Exception {
InputsMetadata metadata = metadataCache.get(jobId);
if (metadata != null)
return metadata;
Expand Down Expand Up @@ -182,7 +182,7 @@ static final void storeMetadata(String jobId, List<Input> inputs, String referen
Map<String, InputMetadata> metadata = inputs.stream()
.collect(Collectors.toMap(input -> (input.s3Bucket == null ? "" : "s3://" + input.s3Bucket + "/") + input.s3Key,
input -> new InputMetadata(input.byteSize, input.compressed)));
storeMetadata(jobId, new InputsMetadata(metadata, Set.of(jobId), referencedJobId));
storeMetadata(jobId, new InputsMetadata(metadata, new HashSet<>(Set.of(jobId)), referencedJobId));
}

static final List<Input> loadInputsInParallel(String bucketName, String inputS3Prefix) {
Expand Down Expand Up @@ -249,7 +249,7 @@ private static void deleteInputs(String owningJobId, String referencingJob) {
metadata = loadMetadata(owningJobId);
metadata.referencingJobs().remove(referencingJob);
}
catch (IOException ignore) {}
catch (AmazonS3Exception | IOException ignore) {}

//Only delete the inputs if no other job is referencing them anymore
if (metadata == null || metadata.referencingJobs().isEmpty()) {
Expand Down

0 comments on commit 7fc114e

Please sign in to comment.