Skip to content

Commit

Permalink
BB-383: skip transitioning of 0 bytes object to DMF locations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderchan-scality committed Apr 13, 2023
1 parent 61df24d commit 56018b7
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions extensions/lifecycle/tasks/LifecycleTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,21 @@ class LifecycleTask extends BackbeatTask {
});
}


// TODO: remove once DMF supports 0 byte objects
// skips 0 byte transitions to DMF locations
_bb383SkipDMFTransition(objectInfo, site, log) {
if (objectInfo.Size === 0
&& locationConfig[site]
&& locationConfig[site].type === 'dmf') {
log.debug(`skipping transition task for 0 bytes objects to DMF location`, {
site: params.site,
});
return true;
}
return false;
}

/**
* Helper method for NoncurrentVersionTransition.NoncurrentDays rule
* Check if Noncurrent Transition rule applies on the version
Expand All @@ -1159,7 +1174,9 @@ class LifecycleTask extends BackbeatTask {
const ncd = 'NoncurrentDays';
const doesNCVTransitionRuleApply = (rules[ncvt] &&
rules[ncvt][ncd] !== undefined &&
daysSinceInitiated >= rules[ncvt][ncd]);
daysSinceInitiated >= rules[ncvt][ncd]) &&
!this._bb383SkipDMFTransition(version, rules[ncvt].StorageClass, log);

if (doesNCVTransitionRuleApply) {
this._applyTransitionRule({
owner: bucketData.target.owner,
Expand Down Expand Up @@ -1389,7 +1406,8 @@ class LifecycleTask extends BackbeatTask {
log);
return done();
}
if (rules.Transition) {
if (rules.Transition
&& !this._bb383SkipDMFTransition(obj, rules.Transition.StorageClass, log)) {
this._applyTransitionRule({
owner: bucketData.target.owner,
accountId: bucketData.target.accountId,
Expand Down

0 comments on commit 56018b7

Please sign in to comment.