Skip to content

rgw: fix bug deleting a non-existent object also generates a delete marker#48400

Closed
kxkxk wants to merge 2 commits intoceph:mainfrom
kxkxk:fix-delete-marker
Closed

rgw: fix bug deleting a non-existent object also generates a delete marker#48400
kxkxk wants to merge 2 commits intoceph:mainfrom
kxkxk:fix-delete-marker

Conversation

@kxkxk
Copy link

@kxkxk kxkxk commented Oct 8, 2022

fix:https://tracker.ceph.com/issues/56992
Signed-off-by: Yuxuan Yang xuanyu.yang@sincerecloud.com
I don't think rgw should create a delete marker for a non-existent object

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@github-actions github-actions bot added the rgw label Oct 8, 2022
@mattbenjamin mattbenjamin requested a review from ivancich October 9, 2022 21:14
Copy link
Member

@ivancich ivancich left a comment

Choose a reason for hiding this comment

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

I'm also wondering if this is where we should code this. I have a merged PR where we would not add a delete marker after an existing delete marker (see: https://github.com/ceph/ceph/pull/41897/files). There is existing code is src/cls/rgw/cls_rgw.cc in function rgw_bucket_link_olh, which loads in the OLH. In this area (

) if olh_found is false, we have a case where we're trying to add a delete marker when there is no object.

And that would put this adjacent to the stacked delete marker checks.

What do you think?

Copy link
Author

@kxkxk kxkxk left a comment

Choose a reason for hiding this comment

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

I modified this part of the code so that the function is called correctly. My intention is that the bucket does not create delete markers for objects that are not created. This will be achieved by determining whether OLH exists or not.

@kxkxk kxkxk requested a review from ivancich January 29, 2023 06:52
Copy link
Member

@ivancich ivancich left a comment

Choose a reason for hiding this comment

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

Thank you!

return ret;
}

// if the OLH not exist, error out
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add "does" as in "if the OLH does not exist, error out".

Copy link
Author

Choose a reason for hiding this comment

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

Ok, thanks for pointing out

Copy link
Author

@kxkxk kxkxk left a comment

Choose a reason for hiding this comment

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

Correct comment errors

@ivancich ivancich added the DNM label Jan 31, 2023
@ivancich
Copy link
Member

I just realized this is 10 commits. Are you familiar with how to squash all this down to a single commit? If you'd like some guidance, just let me know. I've added a DNM (do not merge) tag so prevent merge until the squash. But QA can proceed.

Also when you're down to one commit, it needs to be signed, as the CI is currently complaining about an unsigned commit.

Thanks!

@kxkxk
Copy link
Author

kxkxk commented Jan 31, 2023

I just realized this is 10 commits. Are you familiar with how to squash all this down to a single commit? If you'd like some guidance, just let me know. I've added a DNM (do not merge) tag so prevent merge until the squash. But QA can proceed.

Also when you're down to one commit, it needs to be signed, as the CI is currently complaining about an unsigned commit.

Thanks!

Got it.
Thanks for your advice!

@kxkxk kxkxk force-pushed the fix-delete-marker branch from 124ad2a to 0d6787d Compare January 31, 2023 09:46
@kxkxk kxkxk force-pushed the fix-delete-marker branch from 0d6787d to d0193ac Compare January 31, 2023 10:00
@ivancich
Copy link
Member

ivancich commented Jan 31, 2023

I just realized this is 10 commits. Are you familiar with how to squash all this down to a single commit? If you'd like some guidance, just let me know. I've added a DNM (do not merge) tag so prevent merge until the squash. But QA can proceed.
Also when you're down to one commit, it needs to be signed, as the CI is currently complaining about an unsigned commit.
Thanks!

Got it. Thanks for your advice!

Great, thank you. I don't know which method you used, but my tool for this is git rebase -i HEAD~_N_, where N is the number of commits. There are special occasions where I use git rebase -ir .... And then when I'm in the editor, I mark selected commits with f.

@ivancich ivancich removed the DNM label Jan 31, 2023
@ivancich
Copy link
Member

@kxkxk, I updated the tracker for backports to quincy and pacific. Please edit if you think it should be different. Thanks!

@kxkxk
Copy link
Author

kxkxk commented Feb 1, 2023

@kxkxk, I updated the tracker for backports to quincy and pacific. Please edit if you think it should be different. Thanks!

It is available on both versions.

Copy link
Author

@kxkxk kxkxk left a comment

Choose a reason for hiding this comment

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

Thanks! I think it's ready.

@cbodley
Copy link
Contributor

cbodley commented Mar 13, 2023

this failed qa on the s3test case test_versioning_multi_object_delete_with_marker_create:

=================================== FAILURES ===================================
____________ test_versioning_multi_object_delete_with_marker_create ____________

    @pytest.mark.fails_on_dbstore
    def test_versioning_multi_object_delete_with_marker_create():
        bucket_name = get_new_bucket()
        client = get_client()

        check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")

        key = 'key'

        response = client.delete_object(Bucket=bucket_name, Key=key)
>       delete_marker_version_id = response['VersionId']
E       KeyError: 'VersionId'

s3tests_boto3/functional/test_s3.py:7531: KeyError

i tested amazon's behavior with the following boto script, and see that they allow this creation of delete markers:

client.delete_object(Bucket='test-nonexistent-delete-marker', Key='nonexistent-key')
response = client.list_object_versions(Bucket='test-nonexistent-delete-marker')
print(response['DeleteMarkers'])

[{'Owner': {'ID': '...'}, 'Key': 'nonexistent-key', 'VersionId': 'H8Czx7yv25IqznMOQbbU4bU.iHKfSqSn', 'IsLatest': True, 'LastModified': datetime.datetime(2023, 3, 13, 14, 55, 48, tzinfo=tzutc())}]

@kxkxk kxkxk requested a review from a team as a code owner March 13, 2023 15:50
@kxkxk
Copy link
Author

kxkxk commented Mar 13, 2023

this failed qa on the s3test case test_versioning_multi_object_delete_with_marker_create:

=================================== FAILURES ===================================
____________ test_versioning_multi_object_delete_with_marker_create ____________

    @pytest.mark.fails_on_dbstore
    def test_versioning_multi_object_delete_with_marker_create():
        bucket_name = get_new_bucket()
        client = get_client()

        check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")

        key = 'key'

        response = client.delete_object(Bucket=bucket_name, Key=key)
>       delete_marker_version_id = response['VersionId']
E       KeyError: 'VersionId'

s3tests_boto3/functional/test_s3.py:7531: KeyError

i tested amazon's behavior with the following boto script, and see that they allow this creation of delete markers:

client.delete_object(Bucket='test-nonexistent-delete-marker', Key='nonexistent-key')
response = client.list_object_versions(Bucket='test-nonexistent-delete-marker')
print(response['DeleteMarkers'])

[{'Owner': {'ID': '...'}, 'Key': 'nonexistent-key', 'VersionId': 'H8Czx7yv25IqznMOQbbU4bU.iHKfSqSn', 'IsLatest': True, 'LastModified': datetime.datetime(2023, 3, 13, 14, 55, 48, tzinfo=tzutc())}]

It should be that I misunderstood the AWS API documentation related to this. I don't understand the point of creating delete markers for non-existent objects. Maybe we should keep pace with Amazon?

@NarrativeBias
Copy link

@kxkxk, mind checking something semi-related to this issue for me?
Those delete markers for non-existent objects are generally successfully cleaned up by the ExpiredObjectDeleteMarker lifecycle however when I create that marker by sending two delete requests and process that lifecycle - there are leftover objects for those markers in the data pool.

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions bot added the stale label Jul 5, 2023
@github-actions
Copy link

github-actions bot commented Aug 4, 2023

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

@github-actions github-actions bot closed this Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants