-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
143d1fc
to
c941dea
Compare
c941dea
to
79c6645
Compare
Extremely good work. |
@irq0 |
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.
generally looks good, but there are a few things that caught my attention. I'll need to do a second pass tomorrow, after reading some code, because I have the nagging feeling we may succumb to races.
src/rgw/driver/sfs/types.cc
Outdated
@@ -258,52 +323,75 @@ void MultipartUpload::abort(const DoutPrefixProvider *dpp) { | |||
objref.reset(); | |||
} | |||
|
|||
bool Bucket::want_new_version(const rgw_obj_key& key, ObjectRef obj) { | |||
return !(key.instance.empty() || key.instance == obj->instance); | |||
bool Bucket::want_specific_version(const rgw_obj_key& key) { |
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 comment on the previous commit goes for this one, I would rather have s/want/wants/
.
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.
👍 agreed. Replacing with local variable as well, the method doesn't make much sense outside get_or_create
0c6678e
to
089ff0b
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.
Looks generally okay to me but I think I'd need another round of review.
The only thing I that I would request to be changed so far is calling std::move on raw pointers.
The "constructor helpers" thingy is more a personal taste thing.
|
||
Object* Object::create_for_multipart(const std::string& name) { | ||
Object* result = new Object(name, UUIDPath::create().get_uuid()); | ||
return result; |
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.
Are all these really needed?
I see them as constructor helpers.
create_for_testing
and create_for_multipart
are the same. (at least for now, it they diverge at some point happy to have 2 different methods)
What about a single create_from_name
? (or even a constructor with a single parameter which is the name)
And the create_for_immediate_deletion
seems a bit weird to me.
If the object is immediately deleted I guess we don't need to set the deleted
attribute to false.
I've tested this already removing the result->deleted = true;
statement and as expected the GC
tests pass.
I think calling the already existing Object(const std::string& _name, const uuid_d& _uuid)
would be enough and we can save having that method around. (less code to be maintained)
I dunno, maybe it is a personal thing... but... to me...
create_from_obj_key
would be just:
Object(const rgw_obj_key & key)
The one with only the name would be:
Object(const std::string& name)
and I would maybe just keep the helper for the query thing.
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 named constructors try to make the more clear what Object is created for. We sometimes use it to retrieve data, sometimes update data, sometimes create a new object. I'd like to remove some of the use cases from Object over time. The named constructors are a first step in that direction. They do feel like overkill right now, but will make it easier to remove dependencies from Object IMHO.
src/rgw/driver/sfs/object.cc
Outdated
objref.reset(std::move(sfs::Object::create_for_query(get_name(), uuid, deleted, | ||
db_version->id))); |
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.
All the create_for_*
functions return a raw pointer.
Why calling std::move
on a raw pointer? I think it adds confusion to the reader.
It would make sense if create_for_*
functions were retuning a std::unique_ptr
...
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.
good catch. will remove
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Improve Object and Bucket encapsulation to make it easy to remove the objects cache and mutex. Add specific named constructors (create_..) to Object that replace construction + metadata_init calls. Make Object create methods return pointers to allow callers to decided how to handle ownership. Without the object cache, we no longer need shared pointers of Object at all places. Separate Object data / metadata deletion (delete_object_data, delete_object_metadata) Add get, set, update methods for Object attrs and meta. Make both private fields. Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
Remove objects cache. Replace with direct Object creation from our SQLite database. This changes semantics of Objects retrieved from Bucket::get_or_create. Previously they pointed to the _same_ in-memory, database object representation. Now, subsequent calls return different Objects created fresh from the database each time. Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
089ff0b
to
e14e9c4
Compare
e14e9c4
to
eef95bb
Compare
Use docstrings, add issue reference. Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
Move the 'from' before 'database' for better readability. Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
Replace method with const bool wants_specific_version. Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
eef95bb
to
162e12d
Compare
pr-triage failure: https://github.com/aquarist-labs/s3gw/issues/404 |
We could, maybe, use this PR to remove (or adapt if we think it is useful for us) that |
that should be a different PR I think. This one can be merged ignoring that check. But I agree that should be fixed before merging this one. |
local test run rebased on #122 successful |
note for the future: failed check has been dropped from this repository, but I was unable to find a way to rerun the workflows while dropping that specific check 🤷 |
Removes the object copy cache to reduce mutexes in the hot path and to enable us to replace linear time object list filters with (indexed) SQL queries.
Split into two parts: 1. Refactoring to encapsulate Object and access to the objects cache better. 2. Remove the cache.
No new tests. Changes already covered by existing tests.
Issue https://github.com/aquarist-labs/s3gw/issues/214
Prepares code base for aquarist-labs/s3gw-tools#203
Checklist