diff --git a/lib/Config.js b/lib/Config.js index 9fe40bf3b6..2fd1483ec9 100644 --- a/lib/Config.js +++ b/lib/Config.js @@ -1328,6 +1328,11 @@ class Config extends EventEmitter { this.multiObjectDeleteConcurrency = extractedNumber; } } + + this.multiObjectDeleteEnableOptimizations = true; + if (config.multiObjectDeleteEnableOptimizations === false) { + this.multiObjectDeleteEnableOptimizations = false; + } } _configureBackends() { diff --git a/lib/api/multiObjectDelete.js b/lib/api/multiObjectDelete.js index a9ce79bc04..b7a0be9a52 100644 --- a/lib/api/multiObjectDelete.js +++ b/lib/api/multiObjectDelete.js @@ -199,6 +199,9 @@ function decodeObjectVersion(entry) { * @return {undefined} */ function initializeMultiObjectDeleteWithBatchingSupport(bucketName, inPlay, log, callback) { + if (config.multiObjectDeleteEnableOptimizations === false) { + return callback(null, {}); + } // If the backend supports batching, we want to optimize the API latency by // first getting all the objects metadata, stored in memory, for later use // in the API. This approach does not change the API architecture, but @@ -340,7 +343,7 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request, options.replayId = objMD.uploadId; } return services.deleteObject(bucketName, objMD, - entry.key, options, true, log, (err, toDelete) => { + entry.key, options, config.multiObjectDeleteEnableOptimizations, log, (err, toDelete) => { if (err) { return callback(err); }