ARSN-617: clean-read filter hiding non-localized versions - #2688
ARSN-617: clean-read filter hiding non-localized versions#2688DarkIsDude wants to merge 3 commits into
Conversation
Hello darkisdude,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.5 #2688 +/- ##
===================================================
+ Coverage 74.65% 74.73% +0.07%
===================================================
Files 227 227
Lines 18606 18631 +25
Branches 3850 3893 +43
===================================================
+ Hits 13890 13923 +33
+ Misses 4711 4703 -8
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
This comment was marked as resolved.
This comment was marked as resolved.
ae474fa to
cad4307
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: |
ed25b4e to
3f941a1
Compare
|
This PR is very difficult to review.
|
In a clean-room D/R deployment, the metadata is replicated before the data is copied locally, so a version can still point at the remote source site (`locations[objMD.dataStoreName].isCRR`). Add a per-call `hideNonLocalizedVersions` flag on the metadata read and listing APIs to keep those versions out of the client's view, so that any backend can implement the same contract. MongoClientInterface builds the filter once from the `locations` configuration and applies it in the query itself, so that listing limits and truncation stay correct. Only the version keys are filtered: a master always points at a localized version, and resolving an absent or placeholder master recomputes it from the localized versions only, whatever the caller's view. MetadataWrapper sets the flag on every read and listing call when the deployment enables it, and logs an error leaving it off when the backend does not advertise the support. Issue: ARSN-617
Unit-test the MongoDB filter and the master resolution against a stubbed collection, the MetadataWrapper wiring against a stubbed backend, and run the whole read and listing surface against a real MongoDB in the functional suite. Issue: ARSN-617
4e0f006 to
3f20f15
Compare
I'm not sure it's in our guidelines to have one dedicated commit for all prettier. The guidelines is put prettier in dedicated commit. Several if needed as you can work from one file to a new file during dev time. Anyway, Claude can rework the history easily so it's done. Do you think we could have split this PR in several part ? |
maeldonn
left a comment
There was a problem hiding this comment.
LGTM, left a few minor nits. Logic looks fine, but since I'm not an expert in this area, please wait for a third review from the team.
| private replicationGroupId: string; | ||
| private database: string; | ||
| private isLocationTransient: Function; | ||
| private nonLocalizedQuery: object | null; |
There was a problem hiding this comment.
| private nonLocalizedQuery: object | null; | |
| private nonLocalizedQuery: Filter<ObjectMetastoreDocument> | null; |
| c: Collection<ObjectMetastoreDocument>, | ||
| objName: string, | ||
| vFormat: string, | ||
| nonLocalizedFilter: object | null, |
There was a problem hiding this comment.
nit: could be refactored with an option object
| * @param {Object | null} nonLocalizedFilter query fragment hiding the | ||
| * non-localized versions. Always the deployment filter, never the caller's | ||
| * view: the version returned stands in for the master, the newest localized | ||
| * version. `null` filters nothing: no `isCRR` location, or a write path | ||
| * waiting on ARSN-618 |
There was a problem hiding this comment.
| * @param {Object | null} nonLocalizedFilter query fragment hiding the | |
| * non-localized versions. Always the deployment filter, never the caller's | |
| * view: the version returned stands in for the master, the newest localized | |
| * version. `null` filters nothing: no `isCRR` location, or a write path | |
| * waiting on ARSN-618 | |
| * @param {Object | null} nonLocalizedFilter query fragment hiding the non-localized | |
| * versions, `null` to filter nothing. |
| const getLatestVersion = this.getLatestVersion; | ||
| const nonLocalizedFilter = params.hideNonLocalizedVersions ? this.nonLocalizedQuery : null; | ||
| // the master is the newest localized version, whatever the caller's view | ||
| const phdResolutionFilter = this.nonLocalizedQuery; |
There was a problem hiding this comment.
Master PlaceHolDer (IIRC when we delete the latest version and must repair the master to point to the previous latest version)
| // or last version is delete marker | ||
| if (!doc || doc.value.isPHD) { | ||
| this.getLatestVersion(c, objName, vFormat, log, (err, value?) => { | ||
| // the master is the newest localized version, whatever the caller's view |
There was a problem hiding this comment.
this comment is duplicated, does it mean we should do something ?
delthas
left a comment
There was a problem hiding this comment.
LGTM code-style wise but this is quite subtle so needs a review from Francois.
(Leaving the approves to Mael and Francois)
Context
https://scality.atlassian.net/browse/ARSN-617
In a clean room, metadata is replicated before the object data is copied locally: until then the version's
dataStoreNamestill points at the remote production site. Such a version is non-localized and must not be visible to clients.What this adds
A per-call
hideNonLocalizedVersionsflag on the metadata read and listing APIs (getObject,getObjects,getBucketAndObject,listObject,listMultipartUploads).Notes for ARSN-618
ARSN-618 answers the same "which version is current" question at write time, unconditionally, and can reuse the condition helpers and the
getLatestVersionfilter parameter added here. Read-time resolution stays necessary for entries that never traverse the write path (mongodump/mongorestore bootstrap and re-bootstrap loads); since the design rejected read-time master filtering, the design and ARSN-618 should record that it now exists. We can also decide to drop it as this use case should not exist in a DR architecture.