Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job failure in cleanDeletedFiles() #711

Open
lberrymage opened this issue Jan 8, 2025 · 0 comments
Open

Job failure in cleanDeletedFiles() #711

lberrymage opened this issue Jan 8, 2025 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@lberrymage
Copy link
Member

Server logs indicate a bug in the implementation of cleanDeletedFiles():

ERROR o.j.server.BackgroundJobPerformer - Job(id=2e94613b-a8cd-4196-8dc2-a504f1086b58, jobName='app.accrescent.parcelo.console.jobs.CleanDeletedFilesKt.cleanDeletedFiles()') processing failed: An exception occurred during the performance of the job
java.lang.IllegalStateException: Batch is empty

This appears to be the result of unconditionally sending object storage deletion requests even when there are no objects staged for deletion. This behavior is exhibited in both the S3 and GCS object storage providers:

val deleteObjectsRequest = transaction {
files
.map { ObjectIdentifier { key = it.s3ObjectKey } }
.let { Delete { objects = it } }
.let {
DeleteObjectsRequest {
bucket = s3Bucket
delete = it
}
}
}
S3Client {
endpointUrl = s3EndpointUrl
region = s3Region
credentialsProvider = StaticCredentialsProvider {
accessKeyId = s3AccessKeyId
secretAccessKey = s3SecretAccessKey
}
}.use { s3Client ->
s3Client.deleteObjects(deleteObjectsRequest)

val blobsToDelete = transaction { files.map { BlobId.of(bucket, it.s3ObjectKey) } }
storage.delete(blobsToDelete)

This can most likely be fixed by only sending the constructed deletion request if there is at least one object to delete.

@lberrymage lberrymage added bug Something isn't working good first issue Good for newcomers labels Jan 8, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Roadmap Jan 8, 2025
@lberrymage lberrymage moved this from Backlog to Next in Roadmap Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Next
Development

No branches or pull requests

1 participant