-
Notifications
You must be signed in to change notification settings - Fork 250
CLDSRV-632 ✨ put metadata edge cases #5913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development/9.1
Are you sure you want to change the base?
CLDSRV-632 ✨ put metadata edge cases #5913
Conversation
Hello darkisdude,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
4e1523f
to
300aaef
Compare
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
Codecov Report❌ Patch coverage is
Additional details and impacted files
@@ Coverage Diff @@
## development/9.1 #5913 +/- ##
===================================================
+ Coverage 83.72% 83.74% +0.01%
===================================================
Files 191 191
Lines 12233 12258 +25
===================================================
+ Hits 10242 10265 +23
- Misses 1991 1993 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
5589b9c
to
59ee1fa
Compare
}); | ||
}, | ||
async () => { | ||
if (versioning && !objMd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when does this !objMd
case happen? Before this function is called, we already call standardMetadataValidateBucketAndObj
(line 1655), which should return the object already...
(and looking at versioningPreprocessing, it seems that i knows how to handle objMd=nil as well as the case where object is/isn't the master?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@francoisferrand when you do a PUT on PutMD and the object does not exists. This case can happens when it's an empty object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not clear why we need the conditional, and not (more) systematically call versioningPreprocessing.
in particular, this function is responsible to handle version-suspended case (i.e. delete previous version). Or is this case objMD == nil a way to detect the insertion case (i.e. create a new version) instead of the udpate case (update -internal- metadata of an existing version, e.g. for replication status or transition)?
may help to have a comment explaining what use-case this "branch" handles.
This case can happens when it's an empty object
do you mean "empty" as in "no data"? I don't understand how it would/should affect the behavior here :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@francoisferrand if we have an objMd (so an object already exists), we don't want to call this function as this function will create a new version and we don't want that. So I would say it's more to detect indeed the insertion case and the update case.
Do you think a comment like If we create a new version of an object (so objMd is null), we should make sure that the masterVersion is versionned. If an object already exists, we just want to update the metadata of the existing object and not create a new one
?
The versionning
is just an "optimisation" but can be removed 🙏.
0b5a099
to
9c143cb
Compare
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
b5c2131
to
da6bfb6
Compare
e0ba601
to
1b518c1
Compare
1b518c1
to
dfc7d0d
Compare
bb7c419
to
dfc7d0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somehow I am not sure this covers all cases - and not confident everything is fully tests: there are tests, but logic is quite intricate with the different versioning cases + different listings/... and all the flags: isNull, isNull2, ...
→ would be worth reviewing the tests to see if we miss some cases (e.g. all the combinations of versioning disabled/enabled/suspended, creating vs updating an object, with previous version/nullVersion/no previous version...). May help to look at putObject tests for inspiration on the test case?
→ since we have multiple backend, and the separation is sometimes not clear (or not clearly documented), we should make sure this test is run both with mongo and metadata backends: is it the case?
// To prevent this, the versionId field is only included in options when it is defined. | ||
if (versionId !== undefined) { | ||
options.versionId = versionId; | ||
omVal.versionId = versionId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the semantics of putObject in metadata layer (either backends, i.e. metadata or mongodbClientInterface) are not clear or precisely defined : does setting this not interract (in some weird or unacceptable way?) the behavior of the versionId
option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I checked, this seems not be the case. But maybe I'm missing something here 😬. Maybe the second review will have more insight
}); | ||
}, | ||
async () => { | ||
if (versioning && !objMd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not clear why we need the conditional, and not (more) systematically call versioningPreprocessing.
in particular, this function is responsible to handle version-suspended case (i.e. delete previous version). Or is this case objMD == nil a way to detect the insertion case (i.e. create a new version) instead of the udpate case (update -internal- metadata of an existing version, e.g. for replication status or transition)?
may help to have a comment explaining what use-case this "branch" handles.
This case can happens when it's an empty object
do you mean "empty" as in "no data"? I don't understand how it would/should affect the behavior here :-/
if (versioningPreprocessingResult?.nullVersionId) { | ||
omVal.nullVersionId = versioningPreprocessingResult.nullVersionId; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in other uses of versioningPreprocessing (in putObject / copyObject / putMpu) we set multiple (and different) fields:
metadataStoreParams.versionId = options.versionId;
metadataStoreParams.versioning = options.versioning;
metadataStoreParams.isNull = options.isNull;
metadataStoreParams.deleteNullKey = options.deleteNullKey;
if (options.extraMD) {
Object.assign(metadataStoreParams, options.extraMD);
}
this gets translated (in metadataStoreObject
) to this:
if (versioning) {
options.versioning = versioning;
}
if (versionId || versionId === '') {
options.versionId = versionId;
}
if (deleteNullKey) {
options.deleteNullKey = deleteNullKey;
}
const { isNull, nullVersionId, nullUploadId, isDeleteMarker } = params;
md.setIsNull(isNull)
.setNullVersionId(nullVersionId)
.setNullUploadId(nullUploadId)
.setIsDeleteMarker(isDeleteMarker);
if (versionId && versionId !== 'null') {
md.setVersionId(versionId);
}
if (isNull && !config.nullVersionCompatMode) {
md.setIsNull2(true);
}
→ so it seems many more fields may be set, to cover all cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good a point, thanks for pointing it. versionId;versioning;isNull;
are already managed by the code before. So that don't make sense to manage them again here 🙏.
I added a the extraMD and the deleteNullKey !
3d6aa73
to
ad98e47
Compare
1842539
to
d04c92d
Compare
So I took time to review tests and path. With the condition |
7e6053c
to
69b41b7
Compare
cae1858
to
4357e13
Compare
Description
Reactivate some tests that were disable because some edge case were not covered.
Motivation and context
Manage 2 use case under the put metadata route:
Related issues
https://scality.atlassian.net/browse/CLDSRV-632
scality/Arsenal#2490