@@ -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