Skip to content

improvement: commit + log + metric on task failure in GC and lifecycle cold-archive#2771

Open
delthas wants to merge 1 commit into
development/9.5from
improvement/BB-772/commit-on-poison-pill
Open

improvement: commit + log + metric on task failure in GC and lifecycle cold-archive#2771
delthas wants to merge 1 commit into
development/9.5from
improvement/BB-772/commit-on-poison-pill

Conversation

@delthas

@delthas delthas commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

TL;DR — Three task error paths returned { committable: false } after their retry budget was exhausted without ever calling onEntryCommittable. The offset never advanced past those entries, they lingered in the OffsetLedger, and with the BB-777 rebalance-wait-for-drain fix now merged this turns every rebalance that catches one into a forced pod restart. This PR flips those sites to commit on final failure, emits a structured error log at the point of drop (including the individual data-store parts so ops can reclaim manually), and adds a per-extension counter that can be queried from Prometheus.

What "final failure" means here

All three sites are wrapped by a BackbeatTask.retry-style helper with a ~5 minute budget and exponential backoff — they only reach the poison-pill path once retries are exhausted or the error is flagged non-retryable. Realistic triggers include:

  • a warm cluster / metadata service / vault outage lasting longer than the retry budget
  • non-retryable backend errors (AccessDenied after a role rotation, Conflict on putMetadata, InvalidRequest)
  • the lifecycle orphan-cleanup path failing to publish because the cold producer can't reach its target topic
  • arsenal.errors.InternalError when the vault-derived client can't be obtained

Why not "kafka will redeliver"

That was the intent behind committable: false, but it doesn't work: Kafka only redelivers on the next assignment (rebalance / restart), and neither path benefits from an upstream cron. The cold-status message is a one-shot notification from the cold backend; the GC deleteArchivedSourceData entry is published exactly once by the archive task in fire-and-forget mode. On top of that, LifecycleTask explicitly skips objects with transitionInProgress=true on later bucket scans, so the regular pipeline won't pick a stuck object back up either. Effectively the current behavior is "hold the offset forever, ledger grows, and next rebalance forces a pod restart."

What this PR does

For each of the three sites:

  1. Stop returning { committable: false } — just call done(err) so the consumer commits the offset like it would for any other completed task.
  2. At the outer retry-wrapper's completion callback (i.e. the point where the retry gave up), emit an error-level log with the entry info, the error message, and the individual data-store parts / locations the task was trying to delete (so ops has enough to reclaim stuck data manually).
  3. Increment a new counter recording the failure so operators can query it from Prometheus:
    • s3_gc_failed_total{origin, location} for GC
    • s3_lifecycle_failed_total{origin, type, location} for lifecycle

The log + metric live at the retry-wrapper's completion callback (not inside the task's own error handler) so they fire exactly once per final give-up, not once per attempt.

Sites covered:

  • GarbageCollectorTask._deleteArchivedSourceData — the archive-side warm-copy cleanup. Parts come from objMD.getLocation() inside the async.waterfall; stashed on the entry via entry.setAttribute('target.locations', ...) so the outer failure log can surface them.
  • GarbageCollectorTask._executeDeleteData — the hot transition / restore-expiration paths. Already committed silently on failure (no poison-pill), but had no log or metric. Parts are already on the entry.
  • LifecycleObjectTransitionProcessor.processColdStorageStatusEntry — the cold-status archive handler. No parts concept (this task manipulates metadata + enqueues GC); log fires without a parts field. Uses this.getProcessorType() for the metric label rather than a hard-coded string.

For GC, the pre-existing ObjNotFound / NoSuchBucket carveout (return with commit, no retry) is simplified from done(err, { committable: true }) to done(err) — same semantics, less noise.

What this PR does not do

  • No dashboards or alerts. The metric is a primitive for ad-hoc extraction on platforms where the ledger leak is observed; dashboards and alert rules are a follow-up.
  • No retry topic, dead-letter topic, or sweeper. That's a separate design conversation. The consequence of this PR is that permanent failures are now visible as an error log + a metric datapoint rather than a silent ledger leak, but the underlying operation is not retried automatically.
  • Does not change the behavior of Pattern A callers (ReplicateObject, MultipleBackendTask, CopyLocationTask, LifecycleUpdateTransitionTask) that use committable: false correctly with a producer-callback onEntryCommittable.

Issue: BB-772

@bert-e

bert-e commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hello delthas,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@scality scality deleted a comment from bert-e Jul 6, 2026
@bert-e

bert-e commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.28%. Comparing base (f28a791) to head (ed4e278).

Files with missing lines Patch % Lines
extensions/gc/GarbageCollectorMetrics.js 75.00% 1 Missing ⚠️
extensions/lifecycle/LifecycleMetrics.js 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
extensions/gc/tasks/GarbageCollectorTask.js 88.00% <100.00%> (+0.71%) ⬆️
...ectProcessor/LifecycleObjectTransitionProcessor.js 70.83% <100.00%> (+20.08%) ⬆️
.../lifecycle/tasks/LifecycleColdStatusArchiveTask.js 91.83% <100.00%> (+2.04%) ⬆️
extensions/gc/GarbageCollectorMetrics.js 90.47% <75.00%> (-3.65%) ⬇️
extensions/lifecycle/LifecycleMetrics.js 97.05% <75.00%> (-0.91%) ⬇️

... and 5 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.22% <ø> (ø)
Core Library 80.98% <ø> (-0.60%) ⬇️
Ingestion 70.13% <ø> (ø)
Lifecycle 80.26% <92.30%> (+0.55%) ⬆️
Oplog Populator 85.83% <ø> (ø)
Replication 61.56% <ø> (ø)
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.5    #2771      +/-   ##
===================================================
- Coverage            75.40%   75.28%   -0.12%     
===================================================
  Files                  201      201              
  Lines                13868    13888      +20     
===================================================
- Hits                 10457    10456       -1     
- Misses                3401     3422      +21     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.08% <0.00%> (-0.02%) ⬇️
api:routes 8.85% <0.00%> (-0.02%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.16% <3.84%> (-1.24%) ⬇️
ingestion 12.28% <0.00%> (-0.02%) ⬇️
lib 7.76% <0.00%> (-0.04%) ⬇️
lifecycle 19.17% <3.84%> (-0.05%) ⬇️
notification 1.00% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.72% <3.84%> (-0.03%) ⬇️
unit 53.94% <92.30%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@delthas delthas marked this pull request as ready for review July 6, 2026 11:11
Comment thread extensions/gc/GarbageCollectorMetrics.js Outdated
Comment thread extensions/lifecycle/objectProcessor/LifecycleObjectTransitionProcessor.js Outdated
Comment thread extensions/lifecycle/LifecycleMetrics.js Outdated
Comment thread extensions/gc/tasks/GarbageCollectorTask.js
Comment thread extensions/gc/tasks/GarbageCollectorTask.js
Comment thread extensions/gc/tasks/GarbageCollectorTask.js
Comment thread extensions/gc/tasks/GarbageCollectorTask.js
Comment thread tests/unit/gc/GarbageCollectorTask.spec.js Outdated
Comment thread tests/unit/gc/GarbageCollectorTask.spec.js Outdated
Comment thread extensions/gc/GarbageCollectorMetrics.js
@delthas delthas force-pushed the improvement/BB-772/commit-on-poison-pill branch from c7a81fb to 8051dd1 Compare July 10, 2026 09:11
…e cold-archive

Two error paths returned { committable: false } to the consumer after
their retry budget was exhausted, then never called onEntryCommittable.
The offset never advanced past these entries and they stayed in the
OffsetLedger indefinitely. With the BB-777 rebalance-wait-for-drain fix,
this now blocks every rebalance until the outer timeout fires and the
pod restarts, instead of just leaking memory.

Neither flow is retriggered by an upstream cron. The cold-status archive
is a one-shot notification from the cold backend, and LifecycleTask
skips objects with transitionInProgress=true on subsequent scans, so
there is no automatic recovery either way. There is also no dead-letter
mechanism today.

Step 1 is to stop pretending: commit the offset on permanent failure,
log an error message at the point where we drop the entry (with the
individual data-store locations / parts so ops can reclaim manually),
and increase a per-extension counter so operators can query it.

- GarbageCollectorTask._deleteArchivedSourceData: move the log + metric
  to the outer retry-wrapper's completion callback so it fires once per
  final give-up rather than per attempt. Simplify the ObjNotFound /
  NoSuchBucket carveout to done(err) (same semantics). Stash the parts
  fetched from metadata on the entry (target.locations) so the outer
  failure log can surface them.
- GarbageCollectorTask._executeDeleteData: same treatment for the hot
  transition / restore-expiration paths (already committed on failure
  but silently). Parts are already on the entry, log them.
- LifecycleObjectTransitionProcessor.processColdStorageStatusEntry:
  same idea, in the caller of retryWrapper.retry. Uses
  this.getProcessorType() rather than a hard-coded string.
- Add s3_gc_failed_total and s3_lifecycle_failed_total counters with
  origin / location labels.
- Unit tests: retry tests assert the metric fires with expected args;
  three new tests on LifecycleObjectTransitionProcessor cover the
  processor's failure metric under retryable=true / retryable=false /
  success. Fast retry backoff in the fixtures so they run in ms.

Issue: BB-772
@delthas delthas force-pushed the improvement/BB-772/commit-on-poison-pill branch from 8051dd1 to ed4e278 Compare July 10, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants