Skip to content

Commit 2faa742

Browse files
fix concurrent mpu duplicate objects bug
Issue : ARSN-513
1 parent 55b4425 commit 2faa742

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/storage/metadata/mongoclient/MongoClientInterface.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export type ObjectMDOperationParams = {
139139
needOplogUpdate: boolean,
140140
originOp: string,
141141
doesNotNeedOpogUpdate?: boolean,
142+
preventConcurrentCompletion?: boolean,
142143
conditions: any,
143144
};
144145

@@ -1200,6 +1201,9 @@ class MongoClientInterface {
12001201
* @param {string} params.vFormat - object key format.
12011202
* @param {boolean} params.needOplogUpdate - If true, the object is directly put into the collection
12021203
* with updating the operation log.
1204+
* @param {boolean} params.preventConcurrentCompletion - If true, the object is only created if
1205+
* completeInProgress is not already set to true. Fix this concurrent completeMultipartUpload issue :
1206+
* https://scality.atlassian.net/jira/software/c/projects/OS/boards/268?selectedIssue=CLDSRV-687
12031207
* @param {Object} log - The logger to use.
12041208
* @param {Function} cb - The callback function to call when the operation is complete. It is called with an error
12051209
* if there is an issue with the operation.
@@ -1220,6 +1224,9 @@ class MongoClientInterface {
12201224
}
12211225
const key = formatMasterKey(objName, params.vFormat);
12221226
const putFilter = { _id: key };
1227+
if (params?.preventConcurrentCompletion) {
1228+
putFilter['value.completeInProgress'] = { $ne: true };
1229+
}
12231230
return collection.updateOne(putFilter, {
12241231
$set: {
12251232
_id: key,

0 commit comments

Comments
 (0)