Handle BucketAlreadyExists races and bump arsenal for MPU afterEach fix#6222
Handle BucketAlreadyExists races and bump arsenal for MPU afterEach fix#6222benzekrimaha wants to merge 4 commits into
Conversation
Hello benzekrimaha,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
ab63d85 to
2cae9bc
Compare
Request integration branchesWaiting for integration branch creation to be requested by the user. To request integration branches, please comment on this pull request with the following command: Alternatively, the |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_integration_branches |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_pull_requests, create_integration_branches |
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 1 file with indirect coverage changes @@ Coverage Diff @@
## development/9.3 #6222 +/- ##
===================================================
- Coverage 84.93% 84.91% -0.03%
===================================================
Files 206 206
Lines 13366 13374 +8
===================================================
+ Hits 11353 11357 +4
- Misses 2013 2017 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
2cae9bc to
6178ad8
Compare
Request integration branchesWaiting for integration branch creation to be requested by the user. To request integration branches, please comment on this pull request with the following command: Alternatively, the |
71b7d71 to
0a09689
Compare
| if (err) { | ||
| return callback(err); | ||
| } | ||
| return callback(null, data); | ||
| }); | ||
| }, | ||
| }, | ||
| }, | ||
| // Function to run upon finishing both parallel requests | ||
| (err, results) => { | ||
| if (err) { | ||
| return cb(err); |
a216db5 to
b8c7b85
Compare
ARSN-613 makes Mongo createBucket return BucketAlreadyExists instead of silent idempotence. Continue bucket creation follow-up when a concurrent call already created the metastore entry (freshStartCreateBucket), and fetch the existing MPU shadow bucket when getMPUBucket races. Issue: CLDSRV-919
Cover freshStartCreateBucket continuing after a concurrent create and getMPUBucket refetching the existing MPU shadow bucket. Issue: CLDSRV-919
Pull in Arsenal 8.4.20 at 0bd1b04c (ARSN-613), including the usersBucketHack getBucket-first fix paired with this cloudserver change. Issue: CLDSRV-919
The changed-files prettier CI check validates whole files, not just the modified lines. Issue: CLDSRV-919
b8c7b85 to
19a2bd2
Compare
francoisferrand
left a comment
There was a problem hiding this comment.
nit: this is exactly the kind of PR where prettier is really adding noise... 5-10 lines of "real" change, but prettier fully rewrote 2 large files...
| } else { | ||
| log.trace('created bucket in metadata'); | ||
| } | ||
| return addToUsersBucket(canonicalID, bucketName, bucket, log, err => { |
There was a problem hiding this comment.
should not be be done if bucket already exists, to avoid race and/or incorrect content?
There was a problem hiding this comment.
I also don't understand why bucket already exists error does not cause the function to return early with an error ?
More generally i don't understand why this wasn't catched before in the err ?
I would've expect current behavior to be :
CreateBucket(bucketName) => return err because collision in the db on bucket name, then return callback(err)
I think I'm missing some context information about : what trigger this bug precisely, cuz the pr talks about MPU but here we are fixing a function called freshStartCreateBucket, is this not called all the time to create any bucket ?
| return metadata.createBucket(MPUBucketName, mpuBucket, log, | ||
| err => { | ||
| if (err?.is?.BucketAlreadyExists) { | ||
| return metadata.getBucket(MPUBucketName, log, |
There was a problem hiding this comment.
is this function getMPUBucket() called a lot (it is not an s3 api, not sure if it is called everywhere in mpu code, or just in a few places) : if that is the case, maybe we should plan another improvement to let createBucket return the bucket data as well it case it already exists.
...or maybe we could just return the (existing) mpuBucket variable? for actual buckets, there may be more in the BucketInfo -tags, lifecycle rules...-, but likely not the case for mpu's BucketInfo ?
| * upload bucket or error if any | ||
| * @return {undefined} | ||
| */ | ||
| getMPUBucket(destinationBucket, bucketName, log, cb) { |
There was a problem hiding this comment.
Mhh. I find this very weird :
It's called
GetMpuBucket
It currently does :
GetBucket, if not found, create it.
So ok this is like a "get or create if not found".
But then with the new code changes, this function becomes
GetBucket, if not found, create it. When creating it, if it already exists, getBucket
But if the bucket was not found in the first place, why would we get an "alreadyExists" error when creating it 🤔 ? Race condition ? But then, this is infinite, because in the last getBucket you can also get a notExist error 🤔
Summary
Fix MPU shadow-bucket creation races in cloudserver callers and bump arsenal to 8.4.20 (ARSN-613).
ARSN-613 makes
MongoClientInterface.createBucket()returnBucketAlreadyExistson concurrent duplicates instead of silent idempotence. Cloudserver must handle that contract:freshStartCreateBucket: continueaddToUsersBucket/ transient cleanup when the metastore entry already exists.getMPUBucket: onBucketAlreadyExists, fetch and return the existing MPU shadow bucket.This fixes the intermittent
afterEachfailure inmpuVersion.js("We encountered an internal error") whenListMultipartUploadsraces on MPU shadow bucket creation during test cleanup.Paired with Arsenal PR #2672 (ARSN-613).
Issue: CLDSRV-919