fix(storage): honor --enable-rapid-writes flag during object overwrites for pirlo buckets - #5004
fix(storage): honor --enable-rapid-writes flag during object overwrites for pirlo buckets#5004vipnydav wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates CreateObject and CreateObjectChunkWriter in internal/storage/bucket_handle.go to explicitly clear req.StorageClass when rapid writes are disabled, preventing the inheritance of the RAPID storage class from overwritten objects. The reviewer suggested refactoring the if/else if conditionals to switch statements to avoid calling bh.BucketType() twice and to write more idiomatic Go code.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5004 +/- ##
==========================================
+ Coverage 83.81% 83.82% +0.01%
==========================================
Files 174 174
Lines 21376 21382 +6
==========================================
+ Hits 17916 17924 +8
+ Misses 2779 2778 -1
+ Partials 681 680 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // If rapid writes are disabled, we explicitly clear the storage class to prevent | ||
| // inheriting the RAPID storage class from an overwritten object and write it to | ||
| // the bucket's default storage class. | ||
| switch bh.BucketType().Pirlo { |
There was a problem hiding this comment.
you can extract this logic into a common method and use at both the places
There was a problem hiding this comment.
we should avoid overriding variables in a different function as it is difficult to main in long run, which method is modifiying what and the order.
i would suggest adding a method getSTorageClassForCreateObject and use this in the CreateObject method
req.storageClass = getStorageClassForCreateObject(req)
There was a problem hiding this comment.
Agreed. Updated the helper method to return the storage class and assign it to req.StorageClass directly in the caller.
|
Hi @vadlakondaswetha, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
Description
When overwriting an existing object, GCSFuse currently copies the original object's storage class into the new request. If an object with the
RAPIDstorage class in a pirlo bucket is overwritten while the GCSFuse mount flag--enable-rapid-writesis set tofalse, the request fails with anInvalidArgumenterror. This occurs because the combination of using the Resumable upload API (which is used when rapid writes are disabled) and explicitly passing theRAPIDstorage class is rejected by GCS.This PR fixes the issue by explicitly clearing the storage class (
req.StorageClass = "") for pirlo buckets when rapid writes are disabled. This ensures GCSFuse strictly honors the mount flag rather than inheriting the original object'sRAPIDstorage class, allowing the overwritten pirlo bucket object to correctly fall back to the bucket's default storage class instead.Link to the issue in case of a bug fix.
b/543390252
Testing details
Any backward incompatible change? If so, please explain.
No.