Skip to content

BB-786: trigger cold transition from oplog - #2830

Open
francoisferrand wants to merge 2 commits into
development/9.6from
improvement/BB-786-direct-to-cold
Open

BB-786: trigger cold transition from oplog#2830
francoisferrand wants to merge 2 commits into
development/9.6from
improvement/BB-786-direct-to-cold

Conversation

@francoisferrand

@francoisferrand francoisferrand commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Support "direct-to-cold" transitions: an object uploaded with a cold storage class must end up archived in that cold location, without waiting for a lifecycle rule.

Cloudserver (out of scope here) stores the data in the hot location on such a PUT, and records the requested cold class in x-amz-storage-class together with the transition-in-progress flag, while keeping the ordinary create origin op so that bucket notifications still fire.

The lifecycle queue populator now detects these objects from the MongoDB oplog and publishes the cold archive request, reusing the exact message shape of ReplicationAPI.sendDataMoverAction: the whole downstream pipeline (Sorbet -> cold status topic -> LifecycleColdStatusArchiveTask -> GC) is unchanged. The populator is strictly publish-only, and never writes object metadata. The discriminator only accepts origin ops that backbeat itself never writes, so a transition is never re-triggered by its own metadata updates; objects already holding archive.archiveInfo are excluded, while a pending deferred restore is not.

The transition-in-progress flag must be kept when requeuing such an object, since that flag (together with the cold storage class) is precisely what identifies it as pending: clearing it would hide the object from the populator and break the retry loop after a single attempt. Conversely, a bucket lifecycle rule must not transition an object which is already declared as cold.

Finally, the metadata update completing the transition is stamped with a distinct s3:LifecycleTransition:Direct origin op when the object already declared the target cold class, so consumers can tell a direct transition from a lifecycle-driven one.

Issue: BB-786

@bert-e

bert-e commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Hello francoisferrand,

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.
/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.

@francoisferrand
francoisferrand changed the base branch from development/9.0 to development/9.6 August 25, 2026 12:58
@scality scality deleted a comment from bert-e Aug 25, 2026
@bert-e

bert-e commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Branches have diverged

This pull request's source branch improvement/BB-786-direct-to-cold has diverged from
development/9.6 by more than 50 commits.

To avoid any integration risks, please re-synchronize them using one of the
following solutions:

  • Merge origin/development/9.6 into improvement/BB-786-direct-to-cold
  • Rebase improvement/BB-786-direct-to-cold onto origin/development/9.6

Note: If you choose to rebase, you may have to ask me to rebuild
integration branches using the reset command.

@scality scality deleted a comment from bert-e Aug 25, 2026
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.87%. Comparing base (dc81c3d) to head (85b3f9f).

Files with missing lines Patch % Lines
extensions/lifecycle/LifecycleQueuePopulator.js 95.83% 2 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.09%) ⬆️
.../lifecycle/tasks/LifecycleColdStatusArchiveTask.js 92.00% <100.00%> (+0.16%) ⬆️
...le/tasks/LifecycleResetTransitionInProgressTask.js 82.60% <100.00%> (+2.60%) ⬆️
extensions/lifecycle/tasks/LifecycleTask.js 91.76% <100.00%> (+0.04%) ⬆️
extensions/lifecycle/LifecycleQueuePopulator.js 80.41% <95.83%> (+1.18%) ⬆️

... and 4 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.25% <ø> (ø)
Core Library 81.70% <ø> (-0.75%) ⬇️
Ingestion 71.37% <ø> (ø)
Lifecycle 80.58% <96.49%> (+0.12%) ⬆️
Oplog Populator 85.80% <ø> (ø)
Replication 62.17% <ø> (ø)
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.6    #2830      +/-   ##
===================================================
- Coverage            76.13%   75.87%   -0.27%     
===================================================
  Files                  203      203              
  Lines                14029    14070      +41     
===================================================
- Hits                 10681    10675       -6     
- Misses                3338     3385      +47     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.41% <0.00%> (-0.03%) ⬇️
api:routes 9.17% <0.00%> (-0.03%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.62% <1.75%> (-1.21%) ⬇️
ingestion 12.54% <0.00%> (-0.04%) ⬇️
lib 9.17% <0.00%> (-0.05%) ⬇️
lifecycle 19.57% <3.50%> (-0.05%) ⬇️
notification 1.01% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 19.12% <0.00%> (-0.14%) ⬇️
unit 55.96% <96.49%> (+0.40%) ⬆️

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.

@francoisferrand francoisferrand self-assigned this Aug 25, 2026
@francoisferrand
francoisferrand force-pushed the improvement/BB-786-direct-to-cold branch from c10b011 to 02191ba Compare August 28, 2026 11:14
@bert-e

bert-e commented Aug 28, 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

@francoisferrand
francoisferrand requested review from a team, DarkIsDude and benzekrimaha August 28, 2026 11:19
@francoisferrand francoisferrand removed their assignment Aug 28, 2026
Support "direct-to-cold" transitions: when an object is uploaded with a
cold storage class, cloudserver stores the data in the hot location and
records the requested cold class in the object metadata, together with
the transition-in-progress flag. The lifecycle queue populator now
detects these objects from the oplog and publishes the cold archive
request, reusing the whole existing transition pipeline.

The transition-in-progress flag must not be cleared while requeuing such
an object, since the flag (and the cold storage class) is what identifies
it as pending a direct transition. Conversely, a bucket lifecycle rule
must not transition an object which is already declared as cold.

The metadata update completing the transition is stamped with a distinct
's3:LifecycleTransition:Direct' origin op, so that consumers can tell a
direct transition from a lifecycle-driven one.

Issue: BB-786
The queue populator parsed each oplog entry several times: once in filter()
to look at the bucket, then again in every handler it may call. Each handler
also re-checked the originOp it cares about, so the list of interesting
operations was spread over the whole file.

Decode the entry once in filter() and switch on the originOp there, passing
the parsed value down. Handlers now only decide whether the object itself
qualifies, which is what the new transition handler needs anyway.

Issue: BB-786
@francoisferrand
francoisferrand force-pushed the improvement/BB-786-direct-to-cold branch from 02191ba to 85b3f9f Compare August 28, 2026 15:59

// The object already exposes the location it is transitioned to, so this is a
// direct-to-cold transition.
const isDirect = objMD.getAmzStorageClass() === newLocation;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move that to a dedicated function and avoid comment + code duplication ? Like something hasTargetedLocation ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or better, return directly the target OriginOp ?)

* @param {ObjectMD} md - object metadata
* @return {boolean} true if this is a pending direct transition
*/
_isDirectTransition(md) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_isDirectTransition(md) {
_isDirectToColdTransition(md) {


// The object already exposes the location it is transitioned to, so this is a
// direct-to-cold transition.
const isDirect = objMD.getAmzStorageClass() === newLocation;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const isDirect = objMD.getAmzStorageClass() === newLocation;
const isDirectToCold = objMD.getAmzStorageClass() === newLocation;

/**
* Check whether the object transition was requested directly in the PUT request (as opposed
* to being triggered by a lifecycle rule): in that case the requested cold storage class is
* declared in the object metadata, while the data still lies in a hot location.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* declared in the object metadata, while the data still lies in a hot location.
* Check that the object is a direct to cold transition (without lifecycle trigger)

The next of the description describe the inside of the function

}
// Skip direct-to-cold objects, whose transition is triggered by the queue
// populator and require the transition in progress flag to be set
if (locationsConfig[objectMD.getAmzStorageClass()]?.isCold) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread extensions/gc/tasks/GarbageCollectorTask.js
objectVersion: version,
requestId: uuid(),
size: value['content-length'],
eTag: value['content-md5'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add " ? Not sure about this one here

Comment thread extensions/lifecycle/LifecycleQueuePopulator.js
Comment on lines +291 to +292
// if entry is a versioned object and is the master entry, skip task as
// the non-master entry will be processed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// if entry is a versioned object and is the master entry, skip task as
// the non-master entry will be processed
// Skip it as the key will be processed by the non-master entry


// if entry is a versioned object and is the master entry, skip task as
// the non-master entry will be processed
if (this._isVersionedObject(value) && isMasterKey(entry.key)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy/paste, should we refactor that to have the logic at one place ?

@bert-e

bert-e commented Aug 31, 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

The following reviewers are expecting changes from the author, or must review again:

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.

3 participants