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

Enhancement: Implement Chunk Deletion for Multi-part Uploaded Files on GCP and Openstack Cloud Providers #673

Merged
merged 20 commits into from
Nov 22, 2023

Conversation

anveshreddy18
Copy link
Contributor

@anveshreddy18 anveshreddy18 commented Oct 27, 2023

What this PR does / why we need it:

After the snapshots are uploaded as multiple parts (Chunks) to cloud storage buckets, chunks are not auto-deleted on a few cloud providers. Out of the providers we use, GCP & OpenStack does not delete the chunks after forming composite object. These chunks take up space equal to its corresponding composite object. With this PR, storage occupancy & cost of the bucket can be reduced to half.

Added functionality in GC to delete chunks

Which issue(s) this PR fixes:
Fixes #268

Special notes for your reviewer:

Release note:

Enhanced Garbage Collector to garbage collect the chunks for cloud providers like GCP and OpenStack which does not automatically delete snapshot chunks after the formation of a composite object.

…triggered instead of waiting for the chunks to get deleted when the corresponding snapshot is garbage collected
@CLAassistant
Copy link

CLAassistant commented Oct 27, 2023

CLA assistant check
All committers have signed the CLA.

@gardener-robot gardener-robot added needs/review Needs review size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Oct 27, 2023
@gardener-robot-ci-1
Copy link
Contributor

Thank you @anveshreddy18 for your contribution. Before I can start building your PR, a member of the organization must set the required label(s) {'reviewed/ok-to-test'}. Once started, you can check the build status in the PR checks section below.

@anveshreddy18 anveshreddy18 added the area/cost Cost related label Oct 27, 2023
@anveshreddy18 anveshreddy18 marked this pull request as ready for review October 27, 2023 07:09
@anveshreddy18 anveshreddy18 requested a review from a team as a code owner October 27, 2023 07:09
@seshachalam-yv seshachalam-yv added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 4, 2023
@gardener-robot-ci-3 gardener-robot-ci-3 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 4, 2023
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapstore/gcs_snapstore.go Outdated Show resolved Hide resolved
@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Nov 7, 2023
…ext timeout

* Timeout same as chunk upload timeout
* Collected individual chunk deletion errors into a errList
* Affected code: Gcs & Swift snapstore chunk deletion
@gardener-robot gardener-robot added size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) and removed size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Nov 13, 2023
@anveshreddy18 anveshreddy18 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) os/suse-chost Related to SUSE Container Host OS and removed os/suse-chost Related to SUSE Container Host OS labels Nov 13, 2023
@anveshreddy18
Copy link
Contributor Author

Context:: After discussing the need for immediate chunk deletion, it is decided that we don't need to make it complex and also functionality wise, it should be done by GC so letting GC delete the chunks.

My recent commit has changes according to that. Please take a look once @seshachalam-yv @ishan16696

@ishan16696
Copy link
Member

Context:: After discussing the need for immediate chunk deletion, it is decided that we don't need to make it complex and also functionality wise, it should be done by GC so letting GC delete the chunks.

Thanks @anveshreddy18 for changes, please change the release note accordingly to reflect the functionality.

pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
pkg/snapshot/snapshotter/garbagecollector.go Outdated Show resolved Hide resolved
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 22, 2023
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 22, 2023
Copy link
Contributor

@seshachalam-yv seshachalam-yv left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/changes Needs (more) changes needs/review Needs review labels Nov 22, 2023
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 22, 2023
@ishan16696 ishan16696 merged commit de13fc2 into gardener:master Nov 22, 2023
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Nov 22, 2023
ishan16696 pushed a commit to ishan16696/etcd-backup-restore that referenced this pull request Nov 22, 2023
…n GCP and Openstack Cloud Providers (gardener#673)

* Added generic functionality to garbage collect the chunks when GC is triggered instead of waiting for the chunks to get deleted when the corresponding snapshot is garbage collected

* Deleting chunks from GCS bucket immediately after the composite object is uploaded

* Deleting chunks from OpenStack bucket immediately after the composite object is uploaded

* Add logs for count of chunks getting deleted

* Updated comments and code for readability

* Fixed a bug in tests

* Transfer the immediate chunk deletion logic to new function with context timeout

* Timeout same as chunk upload timeout
* Collected individual chunk deletion errors into a errList
* Affected code: Gcs & Swift snapstore chunk deletion

* Add logs after successfully performing chunk deletion

* Fix snapstore tests, update comments

* Parallelize chunk deletion
* For better performance
* To prevent blocking the snapshotter while chunk deletion for older snapshot is underway

* Add comment

* Add mutex to prevent DATA RACE in ObjectMap of mock GCS & Swift clients while deleting chunks in parallel

* Minor fixes

* Add mutex to prevent parallel read & write for GCS Mock client

* Improved error collection in chunk deletion

* Remove immediate chunk deletion, address edge case in Garbage Collection

* Address review comments

* Minor fixes
ishan16696 added a commit that referenced this pull request Nov 22, 2023
…n GCP and Openstack Cloud Providers (#673) (#682)

* Added generic functionality to garbage collect the chunks when GC is triggered instead of waiting for the chunks to get deleted when the corresponding snapshot is garbage collected

* Deleting chunks from GCS bucket immediately after the composite object is uploaded

* Deleting chunks from OpenStack bucket immediately after the composite object is uploaded

* Add logs for count of chunks getting deleted

* Updated comments and code for readability

* Fixed a bug in tests

* Transfer the immediate chunk deletion logic to new function with context timeout

* Timeout same as chunk upload timeout
* Collected individual chunk deletion errors into a errList
* Affected code: Gcs & Swift snapstore chunk deletion

* Add logs after successfully performing chunk deletion

* Fix snapstore tests, update comments

* Parallelize chunk deletion
* For better performance
* To prevent blocking the snapshotter while chunk deletion for older snapshot is underway

* Add comment

* Add mutex to prevent DATA RACE in ObjectMap of mock GCS & Swift clients while deleting chunks in parallel

* Minor fixes

* Add mutex to prevent parallel read & write for GCS Mock client

* Improved error collection in chunk deletion

* Remove immediate chunk deletion, address edge case in Garbage Collection

* Address review comments

* Minor fixes

Co-authored-by: Anvesh Reddy Pinnapureddy <anvesh.reddy.pinnapureddy@sap.com>
@anveshreddy18 anveshreddy18 added the kind/enhancement Enhancement, improvement, extension label Jan 30, 2024
@anveshreddy18 anveshreddy18 deleted the fix/chunk-deletion branch February 20, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cost Cost related kind/enhancement Enhancement, improvement, extension needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/lgtm Has approval for merging reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/s Size of pull request is small (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Individual chunks of multipart upload are still present after upload has been completed
9 participants