Skip to content

Conversation

@alja
Copy link
Owner

@alja alja commented Jun 30, 2025

This code adds cache-control check using File::Fctnl and FileSystem::Query.
The change is related to pelican-client code PelicanPlatform/xrdcl-pelican#59

@alja
Copy link
Owner Author

alja commented Jun 30, 2025

@osschar @bbockelm
The validation has to be optional.

Should I introduce pfc.cache-validation parameter?
or
pfc.http-cache-control-validation ?

@alja
Copy link
Owner Author

alja commented Jun 30, 2025

Test

Check cache control values with curl -I option from origin

alja@green:~/xrd-dev/test$ curl -I http://xrd-cache-1.t2.ucsd.edu/alja/sap.png

HTTP/1.1 200 OK

Date: Wed, 02 Apr 2025 20:44:28 GMT

Server: Apache/2.4.57 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12 Perl/v5.32.1

Last-Modified: Wed, 02 Apr 2025 19:00:04 GMT

ETag: "8a6-631d042d52fef"

Accept-Ranges: bytes

Content-Length: 2214

Cache-Control: max-age=2592000, must-revalidate, public

Expires: Fri, 02 May 2025 20:44:28 GMT

Content-Type: image/png

Get the file in cache with proxy forwarding

curl http://localhost:7777//http://xrd-cache-1.t2.ucsd.edu/alja/dada.txt

Check saved cache-control attributes as file system xattr in the cinfo file

alja@green:~/xrd-dev$ getfattr -d  data/alja/xstat/sap.png.cinfo
file: data/alja/xstat/sap.png.cinfo
user.pfc.cache-control="{\"ETag\":\"8a6-6342d5a885963\",\"expire\":1749655301,\"revalidate\":true}"
user.pfc.fsize=0spggAAAAAAAA=

@alja alja changed the title [pfc] Cache-Control validation [pfc] Http Cache-Control validation Jun 30, 2025
@alja alja changed the title [pfc] Http Cache-Control validation [pfc] Http Cache-Control Validation Jun 30, 2025
Copy link
Collaborator

@osschar osschar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass, I was also remembering things as I went so maybe some comments are silly.



//------------------------------------------------------------------------------
//! Perform an fcntl() operation (defaults to passthrough).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this documentation needs to be changed, it is mostly copy of Fstat.
i'm not sure if saying that it defaults to passthrough makes sense ... we need to see if there will be some Fcntl calls that need to be handled by the cache / open-file / IO.

XrdCl::QueryCode::Code queryCode = XrdCl::QueryCode::XAttr;
XrdCl::Buffer queryArgs(5);
std::string qs = std::to_string(queryCode);
queryArgs.FromString(qs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it have to go to-string and then from-string? it's internal XrdCl enum/int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants