RGW PUT and multipart
In the book: Chapter 4
Lab
RGW PUT and multipart
Give a key and a size and follow an S3 PUT through radosgw to the bucket index and the data pool, with the RADOS objects it creates.
3RADOS objects
.dir.MARKER.5bucket index shard
10 MiBobject size
ceph_str_hash_linux("photos/2026/11/img_0001.jpg") = 2668161921 → sid ^ ((sid & 0xff) << 24) → % 7877 % 11 = 5
- PUT The client sends PUT /bucket/photos/2026/11/img_0001.jpg with 10 MiB of data; RGWPutObj::execute starts.
RGWPutObj::execute (rgw_op.cc) - authenticate The AWS signature is checked (v4 here) and the user's permissions on the bucket are evaluated.
rgw::auth::s3::AWSAuthStrategy, AWSv4ComplSingle (rgw_auth_s3.cc) - tail stripes As the body streams in, the processor writes 2 tail object(s) of 4 MiB to the data pool.
AtomicObjectProcessor::process, RadosWriter::process - index prepare rgw_bucket_prepare_op marks a pending entry for photos/2026/11/img_0001.jpg on shard 5 of 11, so a crash now leaves a trace that can be cleaned up.
RGWRados::Bucket::UpdateIndex::prepare, cls_rgw rgw_bucket_prepare_op - head write The head object is written in one write_full with the first 4 MiB, the manifest and the attributes (ETag, ACL, content type).
RGWRados::Object::Write::_do_write_meta (write_full + xattrs) - index complete rgw_bucket_complete_op turns the pending entry into a listed object on shard 5 and appends to the bucket index log for sync.
UpdateIndex::complete, rgw_bucket_complete_op (+ bilog) - 200 OK radosgw answers 200 with the ETag; the object is now visible in listings.
RGWPutObj_ObjStore_S3::send_response (rgw_rest_s3.cc)
RADOS objects of this upload
- MARKER_photos/2026/11/img_0001.jpg4 MiB + xattrs
- MARKER__shadow_.RAND32_14 MiB
- MARKER__shadow_.RAND32_22 MiB
Default sizes: the head holds up to 4 MiB (rgw_max_chunk_size), stripes are 4 MiB (rgw_obj_stripe_size), a part is at least 5 MiB (rgw_multipart_min_part_size).
Follows:
src/rgw/rgw_op.cc :: RGWPutObj::execute, RGWCompleteMultipart::executethe PUT and complete-multipart operationssrc/rgw/driver/rados/rgw_putobj_processor.cc :: AtomicObjectProcessor, MultipartObjectProcessorwriting the head, stripes and partssrc/rgw/driver/rados/rgw_rados.cc :: Object::Write::_do_write_meta, Bucket::UpdateIndex::prepare / completewriting the head and updating the indexsrc/cls/rgw/cls_rgw.cc :: rgw_bucket_prepare_op, rgw_bucket_complete_opthe two index operations on the OSDsrc/rgw/services/svc_bi_rados.h :: bucket_shard_index; src/common/ceph_hash.cc :: ceph_str_hash_linuxwhich bucket index shard a key goes tosrc/rgw/driver/rados/rgw_obj_manifest.cc :: RGWObjManifest (head, stripes, rgw_obj_stripe_size 4M)how the object is laid out in RADOS