Skip to content

dr clean view : do not set non localized versions as master versions - #2708

Open
SylvainSenechal wants to merge 3 commits into
development/8.6from
improvement/ARSN-618/clean-read-write
Open

SylvainSenechal wants to merge 3 commits into
development/8.6from
improvement/ARSN-618/clean-read-write

Conversation

@SylvainSenechal

@SylvainSenechal SylvainSenechal commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

ISSUE: ARSN-618

Implementing Clean View for object whose metadata are still sitting in the source location.

The previous PR ARSN-617 dealt with Clean View : Reads
This one is for Clean View : Writes

When mongo processor sends a put request, the mongo interface will now check if the object's location is localized or not. Depending on that it will (or not) update the master : A non localized object version data cannot be promotoed to be a master (edit: except in one particular case highlighted in the review comment 🧐 )

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.80%. Comparing base (1ed7c25) to head (5d0cb6b).

Files with missing lines Patch % Lines
...orage/metadata/mongoclient/MongoClientInterface.ts 96.15% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           development/8.6    #2708      +/-   ##
===================================================
+ Coverage            74.76%   74.80%   +0.04%     
===================================================
  Files                  227      227              
  Lines                18650    18670      +20     
  Branches              3864     3900      +36     
===================================================
+ Hits                 13943    13967      +24     
+ Misses                4702     4698       -4     
  Partials                 5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@SylvainSenechal
SylvainSenechal force-pushed the improvement/ARSN-618/clean-read-write branch 3 times, most recently from 38112f5 to 6d3f6e8 Compare September 18, 2026 13:52
* @param {Function} cb callback
* @return {undefined}
*/
putObjectVerCase4(

@SylvainSenechal SylvainSenechal Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mongo processor will only use VerCase4 to put non localized objects :
https://github.com/scality/backbeat/blob/57765e8f67e61fd7fb2ba36facbda6cc70054a31/extensions/mongoProcessor/MongoQueueProcessor.js#L562

And bootstrap writes directly in mongo without using the Arsenal functions.

So this PR ends up only change put ver case 4.

I could add something like this in the other put functions :

if (this.nonLocalizedLocations.has(objVal.dataStoreName)) {
  return err / log err / log warn
}

because in theory, these put function could later be used to put non localized objects (like if we were to start supporting non versioning objects, we would not use ver case 4 but another), but I don't think we wanna do that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update, I did change the other functions, but for some of them the change can be discussed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And second update, technically, the mongo processor can also call putObjectNoVer, but only for null version, but it could happen in theory : User creates a non versioned bucket and writes objects, then set bucket versioning, then setup disaster recovery on the bucket.

@DarkIsDude
DarkIsDude force-pushed the improvement/ARSN-617/clean-read-filter branch from d2bfe88 to ba915f1 Compare September 18, 2026 15:16
Base automatically changed from improvement/ARSN-617/clean-read-filter to development/8.6 September 18, 2026 15:37
@bert-e

bert-e commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Hello sylvainsenechal,

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
/bypass_source_branch_lineage Bypass the cross-branch contamination check
/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.

@SylvainSenechal
SylvainSenechal force-pushed the improvement/ARSN-618/clean-read-write branch from 6d3f6e8 to 8739266 Compare September 18, 2026 16:08
@scality scality deleted a comment from bert-e Sep 18, 2026
@bert-e

bert-e commented Sep 18, 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

@SylvainSenechal
SylvainSenechal force-pushed the improvement/ARSN-618/clean-read-write branch from 8739266 to b34f39f Compare September 22, 2026 09:42
* @param {Object} objVal object metadata
* @return {Boolean} true if the version is non-localized
*/
isNonLocalized(objVal: ObjectMDData): boolean {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nit: We can discuss the naming of this, because in the functions later we end up with stuff like

if not not
if (!this.isNonLocalized(objVal)) {

const versionId = generateVersionId(this.instanceId, this.replicationGroupId);
objVal.versionId = versionId;
const masterKey = formatMasterKey(objName, params.vFormat);
// the master is the only document this path writes : a non-localized version

@SylvainSenechal SylvainSenechal Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this for putObjectNoVer, putObjectWithCond and putObjectVerCase2, but it's really debatable

Logging an error but continuing...
These 3 functions only write masters. But also from what I found, they won't be called by the mongo processor, so it's more of a security, but as it is it's just not really useful.

Could return an error instead, but currently these errors won't be handled either, or just not do anything and consider that these functions will never be called with a non localized object

* @returns {Promise} A promise that resolves when the operation is complete. The promise is rejected with an error
* if there is an issue with the operation.
*/
putObjectNoVer(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As I wrote in another comment, this function may be a bit more tricky :

  • it can be called by mongo processor for null versions (the scenario would be : User creates non versioned bucket and writes objects, then turn versioning bucket on, then setup disaster recovery)
  • In that scenario, we need to write the master version even if its non localized otherwise we just dont store anything for the object..
  • It's probaly still fine because regardless of what we do, non localized entries will still be hidding by clean read

@SylvainSenechal
SylvainSenechal marked this pull request as ready for review September 22, 2026 13:15
@SylvainSenechal
SylvainSenechal force-pushed the improvement/ARSN-618/clean-read-write branch from b34f39f to c6745fd Compare September 22, 2026 14:42
// the master is the only document this path writes : a non-localized version
// reaching this function is unexpected
if (this.isNonLocalized(value)) {
log.error('putObjectNoVer: writing a non-localized version as master', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

log.error is too severe here. As you noted in the PR comments, the mongo processor can reach putObjectNoVer for null versions (non-versioned bucket → enable versioning → setup DR). That's a legitimate production path, not an unexpected error. Using error level would trigger alerts and noise for normal operation.

Consider log.warn (or log.info) since the write is intentional and the clean-read filter still hides the entry.

Suggested change
log.error('putObjectNoVer: writing a non-localized version as master', {
log.warn('putObjectNoVer: writing a non-localized version as master', {

@SylvainSenechal

Copy link
Copy Markdown
Contributor Author

I'll lint later

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.

2 participants