Repository navigation
rgw: account presigned POST bytes_received in usage log - #68571
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
13 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
cbodley
left a comment
There was a problem hiding this comment.
@lumir-sliva thanks very much for the fix, it looks simple and correct
and thanks for the test coverage, it's great to see that it works. my only concern is that it adds 3 new files to test a very specific issue, and these test scripts carry an ongoing maintenance burden. can i kindly ask you to remove the test changes so we can merge just the fix to rgw_rest.cc?
Presigned POST uploads reported bytes_received=0 in the usage log, while equivalent PUT uploads reported the full object size. The AccountingFilter starts disabled, and only the PUT path explicitly enables it around its body read. POST bodies are consumed via RGWPostObj_ObjStore::read_with_boundary, which did not toggle accounting around its recv_body calls, so every byte pulled off the wire during multipart parsing was silently dropped by the accounter. Wrap the two recv_body calls in read_with_boundary with ACCOUNTING_IO(s)->set_account(true/false), mirroring the PUT pattern in RGWPutObj_ObjStore::get_data. POST uploads now account correctly; PUT behavior is unchanged. Signed-off-by: Lumir Sliva <[email protected]> Tracker: https://tracker.ceph.com/issues/76157 Reported-by: Maxim Monin
3025e02 to
7d2484c
Compare
|
got you casey |
|
pr testing is in progress... More details : https://tracker.ceph.com/issues/76301 |
pr testing completed and approved by @adamemerson , more details In : https://tracker.ceph.com/issues/76301. |
Thanks, maybe @cbodley would you be so kind and press the button. TIA |
Problem
Presigned POST uploads report
bytes_received=0in the usage log (radosgw-admin usage show), while equivalent PUT uploads report the full object size. Operators using the usage log for bandwidth accounting or billing undercount any traffic uploaded via presigned POST (browser form uploads, JavaScript SDKs, etc.).Cause
The
AccountingFilter(src/rgw/rgw_client_io_filters.h) starts withenabled=false, so anyrecv_bodycall made while it is off contributes nothing tototal_received. The PUT path explicitly toggles it on around its body read inRGWPutObj_ObjStore::get_data. The POST path does not. All POST body bytes pass throughRGWPostObj_ObjStore::read_with_boundary, whose tworecv_bodycall sites run with accounting off, so every byte pulled off the wire during multipart parsing is silently dropped by the accounter.Fix
Wrap the two
recv_bodycalls inread_with_boundarywithACCOUNTING_IO(s)->set_account(true/false), mirroring the PUT pattern. POST uploads now account correctly; PUT behavior is unchanged.Test
Reproduced and verified the fix on a vstart cluster (bluestore,
rgw_enable_usage_log=true) by uploading the same 1 MiB body to the same bucket twice, once viaput_objectand once viagenerate_presigned_post+ multipart form POST.Before the patch:
After the patch:
The POST total matches the 1 MiB file body plus the ~1.3 KiB of multipart boundaries and part headers that the wire actually carried.
Tracker: https://tracker.ceph.com/issues/76157
Checklist