Skip to content

Speed up the deletion of objects in trash#174

Open
Vlasdislav wants to merge 4 commits into
open-gpdb:masterfrom
Vlasdislav:feat/parallel-trash-removal
Open

Speed up the deletion of objects in trash#174
Vlasdislav wants to merge 4 commits into
open-gpdb:masterfrom
Vlasdislav:feat/parallel-trash-removal

Conversation

@Vlasdislav

Copy link
Copy Markdown
Contributor

Delete data in parallel from trash, and the degree of parallelism is a configuration parameter

@Vlasdislav Vlasdislav force-pushed the feat/parallel-trash-removal branch from 66dc87b to 61877e5 Compare July 7, 2026 16:28
Comment thread pkg/proc/delete_handler.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to speed up deletion of objects under the trash prefix by performing deletions in parallel, with the parallelism controlled via configuration.

Changes:

  • Refactors DeleteGarbageInBucket to unify “move to trash” vs “delete immediately” behaviors behind a shared operation function and improved logging messages.
  • Introduces a worker-pool based parallel deletion path for trash cleanup and adds trash_delete_workers to vacuum configuration.
  • Improves inline documentation/comments for DeleteMessage fields.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/proc/delete_handler.go Adds parallel trash deletion helper and refactors garbage deletion flow/log messages.
pkg/message/delete_message.go Adds clearer field comments for delete message semantics.
config/vacuum.go Adds TrashDeleteWorkers config field for parallel deletion.
config/instance.go Adds default value embedding for TrashDeleteWorkers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/proc/delete_handler.go
Comment thread pkg/proc/delete_handler.go
Comment thread pkg/proc/delete_handler.go
return dh.StorageInterractor.MoveObject(bucket, file, tp)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a unit test here to check if CrazyDrop not set actually Move Object happens

wg.Wait()
close(failedCh)

failed := make([]string, 0, len(fileList))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a case of failed load here we copy all file names 3d times, so the overall memory consumption will be quite big (we have a million of files). Maybe here we should use *object.ObjectInfo? extractObjectPaths also not needed in that case

@Vlasdislav Vlasdislav Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont't we want to store failed tasks? Example, for retry

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, in a case of retry we still have list of items in memory - let's use them. Do no save it locally. Let's imagine we did it (save locally), what we will be doing at start? Check the modification date for each file once again (in order to be sure we won't delete something we do no want to), and checking is S3 listing. So we perform listing in S3 and we do not need a local list of files.

Comment thread pkg/proc/delete_handler.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants