-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require oplog update only when archived
An oplog update is only required when the object is archived, instead of when lifecycle is enabled: so fix the condition to avoid extra associated load. The update is also required when bucket notification is enabled on the bucket, no change there. Issue: CLDSRV-563
- Loading branch information
1 parent
4025eef
commit 010aa77
Showing
3 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
/** | ||
* _bucketRequiresOplogUpdate - DELETE an object from a bucket | ||
* @param {BucketInfo} bucket - bucket object | ||
* @param {ObjectMD} objMD - object metadata | ||
* @param {BucketInfo} bucket - bucket info | ||
* @return {boolean} whether objects require oplog updates on deletion, or not | ||
*/ | ||
function _bucketRequiresOplogUpdate(bucket) { | ||
function _deleteRequiresOplogUpdate(objMD, bucket) { | ||
// If the object is archived, an oplog update is required | ||
if (objMD.archive) { | ||
return true; | ||
} | ||
// Default behavior is to require an oplog update | ||
if (!bucket || !bucket.getLifecycleConfiguration || !bucket.getNotificationConfiguration) { | ||
if (!bucket || !bucket.getNotificationConfiguration) { | ||
return true; | ||
} | ||
// If the bucket has lifecycle configuration or notification configuration | ||
// set, we also require an oplog update | ||
return bucket.getLifecycleConfiguration() || bucket.getNotificationConfiguration(); | ||
// If the bucket has notification configuration set, we also require an oplog update | ||
return bucket.getNotificationConfiguration(); | ||
} | ||
|
||
module.exports = { | ||
_bucketRequiresOplogUpdate, | ||
_deleteRequiresOplogUpdate, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters