Skip to content

CLDSRV-374 putMetadata API route is not updating null version properly#5167

Merged
bert-e merged 1 commit intodevelopment/8.7from
bugfix/CLDSRV-374/put-metadata-null
May 25, 2023
Merged

CLDSRV-374 putMetadata API route is not updating null version properly#5167
bert-e merged 1 commit intodevelopment/8.7from
bugfix/CLDSRV-374/put-metadata-null

Conversation

@nicolas2bert
Copy link
Copy Markdown
Contributor

@nicolas2bert nicolas2bert commented May 17, 2023

Instead of using the provided "null" value, the metadata "null version id" is used when updating the metadata of a null version.

Note: In S3C, the use of the "putMetadata" call is restricted to versioned buckets.

Issue: CLDSRV-374

@nicolas2bert
Copy link
Copy Markdown
Contributor Author

ping

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 17, 2023

Hello nicolas2bert,

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.

Status report is not available.

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 17, 2023

Incorrect fix version

The Fix Version/s in issue CLDSRV-374 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 7.10.28

  • 7.70.21

  • 8.5.21

  • 8.6.10

  • 8.7.21

Please check the Fix Version/s of CLDSRV-374, or the target
branch of this pull request.

@nicolas2bert
Copy link
Copy Markdown
Contributor Author

ping

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 17, 2023

Conflict

A conflict has been raised during the creation of
integration branch w/8.5/bugfix/CLDSRV-374/put-metadata-null with contents from w/7.70/bugfix/CLDSRV-374/put-metadata-null
and development/8.5.

I have not created the integration branch.

Here are the steps to resolve this conflict:

 $ git fetch
 $ git checkout -B w/8.5/bugfix/CLDSRV-374/put-metadata-null origin/development/8.5
 $ git merge origin/w/7.70/bugfix/CLDSRV-374/put-metadata-null
 $ # <intense conflict resolution>
 $ git commit
 $ git push -u origin w/8.5/bugfix/CLDSRV-374/put-metadata-null

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 17, 2023

Integration data created

I have created the integration data for the additional destination branches.

The following branches will NOT be impacted:

  • development/7.4

You can set option create_pull_requests if you need me to create
integration pull requests in addition to integration branches, with:

@bert-e create_pull_requests

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 17, 2023

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

// versionId
const options = {
versioning: bucketInfo.isVersioningEnabled(),
versioning,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It could be cleaner to

  1. prepare the final versioning and versionId fields to pass in options
  2. build the options object with those two fields

Copy link
Copy Markdown
Contributor Author

@nicolas2bert nicolas2bert May 18, 2023

Choose a reason for hiding this comment

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

I did not change the existing logic much to have the change easily forwarded into development/8.x branches which have a slightly different logic.

if (versioning && !nullVersionId) {
// If the null version does not have a version id, it is a current null version.
// To update the metadata of a current version, versioning is set to false.
options.versioning = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Beware of this, as option fields are converted to strings when passed to Metadata (through the query string), there's a good chance that we interpret versioning: "false" as being true in Metadata, I'd rather recommend to not pass versioning at all if it is false. Metadata should have better parsing of its options on the other hand but I don't think it's done properly now.

@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch from 048a10b to 56ffbb2 Compare May 18, 2023 12:56
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 18, 2023

History mismatch

Merge commit #048a10b191caa788ca526a2690d2a75177e0ad1a on the integration branch
w/7.70/bugfix/CLDSRV-374/put-metadata-null is merging a branch which is neither the current
branch bugfix/CLDSRV-374/put-metadata-null nor the development branch
development/7.70.

It is likely due to a rebase of the branch bugfix/CLDSRV-374/put-metadata-null and the
merge is not possible until all related w/* branches are deleted or updated.

Please use the reset command to have me reinitialize these branches.

@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch 2 times, most recently from 18e0f2b to 1df4eb9 Compare May 18, 2023 15:59
Comment on lines +505 to +506
// NOTE: When 'versioning' is set to true and no 'versionId' is specified,
// it results in the creation of a "new" version, which also updates the master.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Possibly this comment could fit better above if (versioning) {

.then(() => done());
});

it('should update metadata of a current null version', done => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would you mind adding some similar tests on versioning-suspended buckets:

  • when there is an existing null version
  • when there is no existing null version

and make sure we only delete the data when a prior null version exists

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.

In S3C, the use of the "putMetadata" call is restricted to versioned buckets.
I will add tests for Zenko/Artesca branches that support PUT metadata for non-versioned buckets.

// - if a version ID is provided in the query string (updating MD of a specific version) OR
// - if no version ID provided and versioning is not enabled (updating MD of the master key),
// data locations are allowed to be removed as they will be overwritten.
(versionId || !versioning) &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have a doubt that we may remove valid data in the following case, not completely sure, to be checked:

  • versioning-suspended bucket
  • no existing null version

I am thinking that if objMd is the metadata of the current master (a real version), we may remove the master's data and create a new null version, making the old master unreadable.

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.

If there is no existing null version, the object MD (objMd) of the null version will be undefined, resulting in the condition being false.

@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch from 1df4eb9 to f2e9446 Compare May 22, 2023 11:46
@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch from f2e9446 to 16024d6 Compare May 24, 2023 17:04
@nicolas2bert nicolas2bert changed the base branch from development/7.10 to development/8.7 May 24, 2023 17:15
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 24, 2023

Incorrect fix version

The Fix Version/s in issue CLDSRV-374 contains:

  • 7.10.28

  • 7.70.21

  • 8.5.21

  • 8.6.10

  • 8.7.21

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 8.7.21

Please check the Fix Version/s of CLDSRV-374, or the target
branch of this pull request.

@nicolas2bert
Copy link
Copy Markdown
Contributor Author

While it's not the preferred scenario, due to the urgent need to implement this fix in Artesca, we will initially integrate it into the development/8.7 branch and subsequently backport it to the development/7.x branches.

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 24, 2023

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch 2 times, most recently from 0f59a73 to 16434a4 Compare May 24, 2023 22:14
.then(() => done());
});

describe.only('null version', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.only

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.

We eliminated the '.skip' modifier in the 'describe' section of the parent.
Initially, all tests were being skipped.
However, I unskipped them and only executed the null test for the time being.

To address the remaining routeBackbeat tests, I created a follow-up task CLDSRV-394, which is mentioned here: https://github.com/scality/cloudserver/pull/5167/files#diff-e346bc0177b28612b0892a923d8c1d33429b4d7a3c8bd955aadf6e3ccb701dcdR1281.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It may cause confusion to have a committed .only test, usually we follow the pattern of skipping tests until they pass, I think we should follow this scheme here too, so skipping the rest of the tests in this suite and removing .only of the only test we'd like to activate may be more appropriate.

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

it('should create a new null version if versioning suspended and no version', done => {
let objMD;
return async.series([
next => s3.putBucketVersioning({ Bucket: bucket, VersioningConfiguration: { Status: 'Enabled' } },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need to enable versioning before suspending it, you can just put a versioning-suspended status on a nonversioned bucket (same for the other tests).

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.

Indeed, I simply prefer having it Enabled prior to Suspending it as it feels more instinctive to me.
However, as enabling it beforehand is not obligatory, I will eliminate that step.

next),
next => s3.putBucketVersioning({ Bucket: bucket, VersioningConfiguration: { Status: 'Suspended' } },
next),
next => s3.putObject({ Bucket: bucket, Key: keyName, Body: new Buffer(testData) }, next),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it useful to PUT and DELETE an object prior to using the backbeat PUT?

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.

For the test to be closer to reality and to be able "GET" the null version metadata that I will later "PUT".

next),
next => s3.putBucketVersioning({ Bucket: bucket, VersioningConfiguration: { Status: 'Suspended' } },
next),
next => s3.putObject({ Bucket: bucket, Key: keyName, Body: new Buffer(testData) }, next),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's probably no need to PUT an object first before DELETE, as a DELETE would normally put a delete marker with a null version.

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.

Same reason as earlier.
Also, we create the object to GET its metadata.
In my opinion, this appears to be a more realistic scenario.

@jonathan-gramain
Copy link
Copy Markdown
Contributor

Thanks for the extensive test coverage @nicolas2bert

@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch from 16434a4 to 9205084 Compare May 25, 2023 12:45
Instead of using the provided "null" value, the metadata "null version id" is now used when updating the metadata of a null version.
@nicolas2bert nicolas2bert force-pushed the bugfix/CLDSRV-374/put-metadata-null branch from 9205084 to 50cb6a2 Compare May 25, 2023 13:40
@nicolas2bert
Copy link
Copy Markdown
Contributor Author

@bert-e approve

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 25, 2023

In the queue

The changeset has received all authorizations and has been added to the
relevant queue(s). The queue(s) will be merged in the target development
branch(es) as soon as builds have passed.

The changeset will be merged in:

  • ✔️ development/8.7

The following branches will NOT be impacted:

  • development/7.10
  • development/7.4
  • development/7.70
  • development/8.5
  • development/8.6

There is no action required on your side. You will be notified here once
the changeset has been merged. In the unlikely event that the changeset
fails permanently on the queue, a member of the admin team will
contact you to help resolve the matter.

IMPORTANT

Please do not attempt to modify this pull request.

  • Any commit you add on the source branch will trigger a new cycle after the
    current queue is merged.
  • Any commit you add on one of the integration branches will be lost.

If you need this pull request to be removed from the queue, please contact a
member of the admin team now.

The following options are set: approve

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 25, 2023

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/8.7

The following branches have NOT changed:

  • development/7.10
  • development/7.4
  • development/7.70
  • development/8.5
  • development/8.6

Please check the status of the associated issue CLDSRV-374.

Goodbye nicolas2bert.

@bert-e bert-e merged commit 50cb6a2 into development/8.7 May 25, 2023
@bert-e bert-e deleted the bugfix/CLDSRV-374/put-metadata-null branch May 25, 2023 16:56
francoisferrand added a commit that referenced this pull request May 9, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 9, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 9, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 13, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 13, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 14, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 15, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 15, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
francoisferrand added a commit that referenced this pull request May 16, 2025
Revert 7e405ff, as it prevents creating
new versions in versioned buckets when not specifying versionId. The
proper fix was introduced later in [2]

[1] #4655
[2] #5167

Issue: CLDSRV-394
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.

4 participants