From: J. Eric Ivancich Date: Tue, 9 Dec 2025 16:03:13 +0000 (-0500) Subject: rgw: `radosgw-admin object put ...` broken w/ versioned buckets X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ede3eea31bdc53906733bd806bf026b293fa701;p=ceph.git rgw: `radosgw-admin object put ...` broken w/ versioned buckets When this tool was used to write a new version of an object over an existing version, instead of creating a new version it just overwrote the latest version. Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_data_access.cc b/src/rgw/rgw_data_access.cc index 4cbbfeca68e4..d56155121d40 100644 --- a/src/rgw/rgw_data_access.cc +++ b/src/rgw/rgw_data_access.cc @@ -127,19 +127,26 @@ int RGWDataAccess::Object::put(bufferlist& data, std::string req_id = driver->zone_unique_id(driver->get_new_req_id()); std::unique_ptr processor; + + if (bucket_info.versioning_enabled() && obj->get_instance().empty()) { + obj->gen_rand_obj_instance_name(); + } + processor = driver->get_atomic_writer(dpp, y, obj.get(), owner, nullptr, olh_epoch, req_id); int ret = processor->prepare(y); - if (ret < 0) + if (ret < 0) { return ret; + } rgw::sal::DataProcessor *filter = processor.get(); CompressorRef plugin; boost::optional compressor; - const auto& compression_type = driver->get_compression_type(bucket_info.placement_rule); + const auto& compression_type = + driver->get_compression_type(bucket_info.placement_rule); if (compression_type != "none") { plugin = Compressor::create(driver->ctx(), compression_type); if (!plugin) {