Re: RGW: request fields in Lua script return wrong data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think that information on the object exists only in the postRequest
context (because only then we accessed the object).
to get the size of the object in the preRequest context you need to take it
from "Request.ContentLength".
see:
https://github.com/ceph/ceph/blob/cd5bf7d94251de4667f79591d5832e648ab7ccaa/examples/rgw/lua/storage_class.lua

note that this may not be the full size of the object (e.g. in case of
multipart upload). let me know if this a usecase you have, as there might
be a way to handle this in lua using the global RGW table.

On Wed, May 17, 2023 at 6:58 PM <viplanghe6@xxxxxxxxx> wrote:

> Thanks for your answer. I was able to get the Lua debug log. But I think
> some request fields don't work:
>
> I have this lua script, for example:
> if Request.HTTP.StorageClass == 'COLD' then
>   RGWDebugLog(Request.RGWOp .. " request with StorageClass: "  ..
> Request.HTTP.StorageClass .. " Obj name: " .. Request.Object.Name .. "
> Obj ID: " .. Request.Object.Id .. " Size: " .. Request.Object.Size .. "
> MTime: " .. Request.Object.MTime )
> end
>
> I put an 1kb object using boto3:
> s3.Object(bucket, 'test-object6').put(Body="0"*1000, ACL='public-read',
> StorageClass='COLD')
>
> But the size and mtime field provided wrong data?
> Lua INFO: put_obj request with StorageClass: COLD Obj name: test-object6
> Obj ID: test-object6 Size: 0 MTime: 1970-01-01 08:00:00
> _______________________________________________
> ceph-users mailing list -- ceph-users@xxxxxxx
> To unsubscribe send an email to ceph-users-leave@xxxxxxx
>
>
_______________________________________________
ceph-users mailing list -- ceph-users@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux