BB-786: trigger cold transition from oplog - #2830
Conversation
Hello francoisferrand,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Branches have divergedThis pull request's source branch To avoid any integration risks, please re-synchronize them using one of the
Note: If you choose to rebase, you may have to ask me to rebuild |
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 4 files with indirect coverage changes
@@ Coverage Diff @@
## development/9.6 #2830 +/- ##
===================================================
- Coverage 76.13% 76.00% -0.13%
===================================================
Files 204 204
Lines 14056 14097 +41
===================================================
+ Hits 10701 10715 +14
- Misses 3345 3372 +27
Partials 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
c10b011 to
02191ba
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
02191ba to
85b3f9f
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following reviewers are expecting changes from the author, or must review again: |
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
The restore and transition handlers each repeated the same two guards on the oplog entry: mpu shadow bucket keys, and the master entry of a versioned object, which duplicates the version entry processed on its own. Group them in a single predicate, so both handlers agree on what counts as an object entry worth acting upon. In the restore handler this guard sat below the branch adjusting the restore expiry of an already-restored object: master and version entry both reached it, and the adjust message was published twice for every versioned object. Checking upfront leaves a single publication. The delete handler keeps its own guards: it takes the raw entry before parsing, and skips null versions and delete markers as well. Issue: BB-786
85b3f9f to
e9b9e42
Compare
| ); | ||
|
|
||
| const topic = `${coldStorageArchiveTopicPrefix}${coldLocation}`; | ||
| const key = `${entry.bucket}/${entry.key}`; |
There was a problem hiding this comment.
the message matches sendDataMoverAction, the key doesn't: there it's ${bucket}/${key} with the plain key, here it's uri-encoded with the \0<versionId> still on it. Meaning we have the same object, different partition depending on which producer sent it. this is consistent with _handleRestoreOp below, so maybe fine... but does sorbet key on it? if not I'd recommend dropping the "strictly the same" from the description and from the test name.
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-classtogether 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 holdingarchive.archiveInfoare 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:Directorigin 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