From 2107de90f09a8593c982a8a76a29e668d6fe2b70 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Mon, 2 Dec 2024 10:56:40 +0100 Subject: [PATCH 1/2] Properly initialize retry params for lifecycle Issue: BB-635 --- extensions/gc/tasks/GarbageCollectorTask.js | 7 ++----- .../lifecycle/bucketProcessor/LifecycleBucketProcessor.js | 3 ++- extensions/lifecycle/conductor/LifecycleConductor.js | 2 +- .../lifecycle/objectProcessor/LifecycleObjectProcessor.js | 3 +-- extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js | 3 ++- extensions/lifecycle/tasks/LifecycleRequeueTask.js | 3 ++- extensions/lifecycle/tasks/LifecycleTask.js | 2 +- .../lifecycle/tasks/LifecycleUpdateExpirationTask.js | 3 ++- .../lifecycle/tasks/LifecycleUpdateTransitionTask.js | 4 ++-- lib/tasks/BackbeatTask.js | 4 ++-- tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/extensions/gc/tasks/GarbageCollectorTask.js b/extensions/gc/tasks/GarbageCollectorTask.js index cd44cc8f2..50e6b8f06 100644 --- a/extensions/gc/tasks/GarbageCollectorTask.js +++ b/extensions/gc/tasks/GarbageCollectorTask.js @@ -5,6 +5,7 @@ const { ObjectMD } = require('arsenal').models; const { attachReqUids } = require('../../../lib/clients/utils'); const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { GarbageCollectorMetrics } = require('../GarbageCollectorMetrics'); +/** @typedef { import('../GarbageCollector.js') } GarbageCollector */ class GarbageCollectorTask extends BackbeatTask { /** @@ -14,13 +15,9 @@ class GarbageCollectorTask extends BackbeatTask { * @param {GarbageCollector} gc - garbage collector instance */ constructor(gc) { - super(); const gcState = gc.getStateVars(); + super(gcState.gcConfig?.consumer.retry); Object.assign(this, gcState); - const retryParams = gcState.gcConfig?.consumer.retry; - if (retryParams) { - this.retryParams = retryParams; - } } // helper method needed for replication generated entries in which the diff --git a/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js b/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js index 5aa7e13b1..6c9358fe5 100644 --- a/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js +++ b/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js @@ -103,7 +103,7 @@ class LifecycleBucketProcessor { transport, }, this._log); - this.retryWrapper = new BackbeatTask(); + this.retryWrapper = new BackbeatTask(lcConfig.bucketProcessor.retry); // helper object to facilitate the tracking of the the latest x // noncurrent versions of an object when the field @@ -176,6 +176,7 @@ class LifecycleBucketProcessor { getStateVars() { return { producer: this._producer, + processConfig: this._lcConfig.bucketProcessor, bootstrapList: this._repConfig.destination.bootstrapList, bucketTasksTopic: this._lcConfig.bucketTasksTopic, objectTasksTopic: this._lcConfig.objectTasksTopic, diff --git a/extensions/lifecycle/conductor/LifecycleConductor.js b/extensions/lifecycle/conductor/LifecycleConductor.js index c73b69cd5..07fdcdfb4 100644 --- a/extensions/lifecycle/conductor/LifecycleConductor.js +++ b/extensions/lifecycle/conductor/LifecycleConductor.js @@ -530,7 +530,7 @@ class LifecycleConductor { let marker = initMarker; let nEnqueued = 0; const start = new Date(); - const retryWrapper = new BackbeatTask(); + const retryWrapper = new BackbeatTask(this.lcConfig.conductor.retry); this.lastSentId = null; this.lastSentVersion = -1; diff --git a/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js b/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js index fb23012ae..42c0c910a 100644 --- a/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js +++ b/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js @@ -24,7 +24,6 @@ const logIdFromType = { * endpoint using the S3 API. */ class LifecycleObjectProcessor extends EventEmitter { - /** * Constructor of LifecycleObjectProcessor * @@ -65,7 +64,7 @@ class LifecycleObjectProcessor extends EventEmitter { transport, }, this._log); - this.retryWrapper = new BackbeatTask(); + this.retryWrapper = new BackbeatTask(this._processConfig.retry); } getProcessorType() { diff --git a/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js b/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js index e1a3a4c2b..7fa873253 100644 --- a/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js +++ b/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js @@ -5,6 +5,7 @@ const ObjectMD = require('arsenal').models.ObjectMD; const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { attachReqUids } = require('../../../lib/clients/utils'); const { LifecycleMetrics } = require('../LifecycleMetrics'); +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class ObjectLockedError extends Error {} class PendingReplicationError extends Error {} @@ -18,7 +19,7 @@ class LifecycleDeleteObjectTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); this.objectMD = null; } diff --git a/extensions/lifecycle/tasks/LifecycleRequeueTask.js b/extensions/lifecycle/tasks/LifecycleRequeueTask.js index 64615a84d..5a6a8dbb9 100644 --- a/extensions/lifecycle/tasks/LifecycleRequeueTask.js +++ b/extensions/lifecycle/tasks/LifecycleRequeueTask.js @@ -7,6 +7,7 @@ const ObjectMD = require('arsenal').models.ObjectMD; const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { LifecycleMetrics } = require('../LifecycleMetrics'); +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleRequeueTask extends BackbeatTask { @@ -19,7 +20,7 @@ class LifecycleRequeueTask extends BackbeatTask { */ constructor(proc, processName) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); this.processName = processName; } diff --git a/extensions/lifecycle/tasks/LifecycleTask.js b/extensions/lifecycle/tasks/LifecycleTask.js index 2c6142e7a..4b7e1af4c 100644 --- a/extensions/lifecycle/tasks/LifecycleTask.js +++ b/extensions/lifecycle/tasks/LifecycleTask.js @@ -85,7 +85,7 @@ class LifecycleTask extends BackbeatTask { */ constructor(lp) { const lpState = lp.getStateVars(); - super(); + super(lpState.processConfig?.retry); Object.assign(this, lpState); const { transitionOneDayEarlier, expireOneDayEarlier, timeProgressionFactor } = this.lcOptions; diff --git a/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js b/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js index ed893b740..e75289ac5 100644 --- a/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js +++ b/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js @@ -6,6 +6,7 @@ const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); const { LifecycleMetrics } = require('../LifecycleMetrics'); const locations = require('../../../conf/locationConfig.json') || {}; +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleUpdateExpirationTask extends BackbeatTask { /** @@ -16,7 +17,7 @@ class LifecycleUpdateExpirationTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); } diff --git a/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js b/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js index 5253a17b9..33d43eaca 100644 --- a/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js +++ b/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js @@ -6,7 +6,7 @@ const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); const ObjectMD = require('arsenal').models.ObjectMD; const { LifecycleMetrics } = require('../LifecycleMetrics'); - +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleUpdateTransitionTask extends BackbeatTask { /** @@ -17,7 +17,7 @@ class LifecycleUpdateTransitionTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); } diff --git a/lib/tasks/BackbeatTask.js b/lib/tasks/BackbeatTask.js index 64fe9f531..1352bfb2a 100644 --- a/lib/tasks/BackbeatTask.js +++ b/lib/tasks/BackbeatTask.js @@ -5,8 +5,8 @@ const BackOff = require('backo'); */ class BackbeatTask { - constructor() { - this.retryParams = { + constructor(retryParams) { + this.retryParams = retryParams || { timeoutS: 300, backoff: { min: 1000, diff --git a/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js b/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js index 3f72d9e62..e470bb6d4 100644 --- a/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js +++ b/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js @@ -11,7 +11,7 @@ const { ProcessorMock, } = require('../mocks'); -describe('LifecycleResetTransitionInProgressTask', () => { +describe('LifecycleRetriggerRestoreTask', () => { let backbeatMetadataProxyClient; let objectProcessor; let task; From ac883efea2c8bdcd6aafbf31eb8e6c5a5c3652f3 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Mon, 2 Dec 2024 19:06:36 +0100 Subject: [PATCH 2/2] Bump backbeat 8.6.53 Issue: BB-635 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08c874c87..03c0bf9b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbeat", - "version": "8.6.52", + "version": "8.6.53", "description": "Asynchronous queue and job manager", "main": "index.js", "scripts": {