Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

rgw/sfs: Implement new versioning design #153

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

0xavi0
Copy link

@0xavi0 0xavi0 commented Jun 7, 2023

Implements new versioning design following this ADR

  • Includes rgw::sal::Attrs type binding in sqliteorm code, so VersionedObject code for conversions is no longer needed.

    Any value that was a BLOB before and that it's not optional should be good to be bound.
    Just declare the type in the database struct and add this:

     #include "rgw/driver/sfs/sqlite/bindings/blob.h"

    That file uses the previous code to convert ceph types using bufferlist ("rgw/driver/sfs/sqlite/conversion_utils.h")

    Extra code for dealing with optional BLOB will be proposed in a future PR and we'll be able to delete all the conversion
    layers where no strictly needed.

  • Adds transactions for the actions that require more than 1 database access.

  • Simplifies the way a new version is created and moves its logic to a sqlite transaction to avoid race conditions when creating N objects with the same name at once from several threads.

  • Also changed the name of the objects and versioned_objects table names to DBObject and DBVersionedObject

The following s3 tests now pass:

test_bucket_list_return_data_versioning
test_object_copy_versioning_multipart_upload
test_versioning_bucket_create_suspend
test_versioning_obj_create_read_remove
test_versioning_obj_create_read_remove_head
test_versioning_obj_create_versions_remove_all
test_versioning_obj_create_versions_remove_special_names
test_versioning_obj_create_overwrite_multipart
test_versioning_obj_list_marker
test_versioning_copy_obj_version
test_versioning_multi_object_delete
test_versioning_multi_object_delete_with_marker
test_versioning_multi_object_delete_with_marker_create
test_lifecycle_expiration_versioning_enabled
test_versioning_bucket_atomic_upload_return_version_id
test_versioning_bucket_multipart_upload_return_version_id
test_object_lock_suspend_versioning
test_object_copy_versioned_bucket
test_object_copy_versioned_url_encoding
test_multipart_copy_versioned
test_versioned_object_acl
test_versioned_object_acl_no_version_specified
test_versioned_concurrent_object_create_concurrent_remove
test_versioned_concurrent_object_create_and_remove
test_multi_object_delete
test_multi_objectv2_delete
test_bucket_recreate_not_overriding

Fixes: https://github.com/aquarist-labs/s3gw/issues/378
Fixes: https://github.com/aquarist-labs/s3gw/issues/472
Fixes: https://github.com/aquarist-labs/s3gw/issues/547
Fixes: https://github.com/aquarist-labs/s3gw/issues/526
Fixes: https://github.com/aquarist-labs/s3gw/issues/524
Fixes: https://github.com/aquarist-labs/s3gw/issues/519

Signed-off-by: Xavi Garcia xavi.garcia@suse.com

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)
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

@0xavi0 0xavi0 added kind/enhancement Change that positively impacts existing code kind/quality Quality improvements, Refactoring, Automation via CI, E2E, Integration, CLI or REST API labels Jun 7, 2023
@0xavi0 0xavi0 self-assigned this Jun 7, 2023
@0xavi0 0xavi0 requested review from irq0 and jecluis June 7, 2023 15:39
@0xavi0 0xavi0 force-pushed the 472-new-versioning branch 2 times, most recently from 6d645aa to 9aa8030 Compare June 8, 2023 07:57
Copy link
Member

@jecluis jecluis left a comment

Choose a reason for hiding this comment

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

generally looks good, but a few comments I'd like answers to before approving or requesting changes :)

src/rgw/driver/dbstore/common/dbstore.h Outdated Show resolved Hide resolved
src/rgw/driver/sfs/object.cc Show resolved Hide resolved
src/rgw/driver/sfs/object.cc Outdated Show resolved Hide resolved
src/rgw/driver/sfs/sqlite/sqlite_versioned_objects.cc Outdated Show resolved Hide resolved
src/rgw/driver/sfs/types.cc Outdated Show resolved Hide resolved
Copy link
Member

@jecluis jecluis left a comment

Choose a reason for hiding this comment

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

cleanup related, otherwise looks good.

src/rgw/driver/sfs/sqlite/sqlite_versioned_objects.cc Outdated Show resolved Hide resolved
src/rgw/driver/sfs/types.cc Outdated Show resolved Hide resolved
Copy link
Member

@irq0 irq0 left a comment

Choose a reason for hiding this comment

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

looks good!

I like how the code now leverages more of sqlite_orm.

General comments:

Some of the sql utility methods would benefit from names that imply if deleted is included or now.

The '_' prefix. I've seen it in the python word for private methods, but not much in c++. What does it mean here? Just private method? Utility method? Method doing actual work (like the do_ prefix in many parts of the ceph codebase)

return _get_versioned_object(bucket_id, object_name, version_id);
}

DBObjectsListItems SQLiteVersionedObjects::list_last_versioned_objects(
Copy link
Member

Choose a reason for hiding this comment

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

Suggest to include the state the objects are in. The name does not imply that deleted objects are filtered out.

Copy link
Author

Choose a reason for hiding this comment

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

okay, sounds good to me. I've renamed it to get_non_deleted_versioned_object

src/rgw/driver/sfs/sqlite/sqlite_versioned_objects.cc Outdated Show resolved Hide resolved
src/rgw/driver/sfs/sqlite/sqlite_versioned_objects.cc Outdated Show resolved Hide resolved
@@ -238,12 +256,10 @@ bool SFSBucket::is_owner(User* user) {
int SFSBucket::check_empty(const DoutPrefixProvider* dpp, optional_yield y) {
Copy link
Member

Choose a reason for hiding this comment

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

(Goold candidate to turn into an sql query in a future PR. )

Q: What is empty?
there is no committed version?
there is no committed or open (== in flight) version?
🤔 is a bucket empty if there are multpart uploads going on?

Copy link
Author

Choose a reason for hiding this comment

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

Yup, I wonder if there are any s3 tests for this.

Copy link
Member

Choose a reason for hiding this comment

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

Surprising to me check_empty is only called from RGWDeleteBucket::execute before doing the remove_bucket call. Surprising because I would have expected that to be part of remove_bucket

Copy link
Member

Choose a reason for hiding this comment

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

The answer here needs to be, I think, that the multipart uploads are simply aborted if the bucket is removed. The multipart upload is a promise of eventually creating something in that bucket, and as such I don't think it's reasonable to hold the bucket to exist just because someone forgot to complete or abort a multipart upload.

Copy link
Member

Choose a reason for hiding this comment

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

Good to know, thanks!

jecluis
jecluis previously approved these changes Jun 8, 2023
jecluis
jecluis previously approved these changes Jun 9, 2023
@jecluis
Copy link
Member

jecluis commented Jun 9, 2023

@irq0 are you satisfied with the changes? Anything else comes to mind? I'd love to merge this soon-ish :)

irq0
irq0 previously approved these changes Jun 9, 2023
@0xavi0
Copy link
Author

0xavi0 commented Jun 9, 2023

I'll merge as soon as CI passes

Implements new versioning design.

Includes `rgw::sal::Attrs` type binding in `sqliteorm` code, so
VersionedObject code for conversions is no longer needed.

Adds transactions for the actions that require more than 1 database
access.

Simplifies the way a new version is created and moves its logic to a
sqlite transaction to avoid race conditions when creating N objects with
the same name at once from several threads.

Fixes: https://github.com/aquarist-labs/s3gw/issues/378
Fixes: https://github.com/aquarist-labs/s3gw/issues/472
Fixes: https://github.com/aquarist-labs/s3gw/issues/547
Fixes: https://github.com/aquarist-labs/s3gw/issues/526
Fixes: https://github.com/aquarist-labs/s3gw/issues/524
Fixes: https://github.com/aquarist-labs/s3gw/issues/519

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
@0xavi0 0xavi0 merged commit b32d1e7 into aquarist-labs:s3gw Jun 9, 2023
0xavi0 added a commit to 0xavi0/ceph that referenced this pull request Jun 12, 2023
After [versioning](aquarist-labs#153) was
merged there are a few more s3 tests passing.

This adds 3 Life cycle plus 1 bucket creation s3 test.

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0 added a commit that referenced this pull request Oct 5, 2023
After [versioning](#153) was
merged there are a few more s3 tests passing.

This adds 3 Life cycle plus 1 bucket creation s3 test.

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0 added a commit to 0xavi0/ceph that referenced this pull request Oct 5, 2023
After [versioning](aquarist-labs#153) was
merged there are a few more s3 tests passing.

This adds 3 Life cycle plus 1 bucket creation s3 test.

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0 added a commit that referenced this pull request Oct 18, 2023
After [versioning](#153) was
merged there are a few more s3 tests passing.

This adds 3 Life cycle plus 1 bucket creation s3 test.

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement Change that positively impacts existing code kind/quality Quality improvements, Refactoring, Automation via CI, E2E, Integration, CLI or REST API
Projects
Archived in project
3 participants