Skip to content

[pfc] Http Cache-Control Validation#89

Open
alja wants to merge 16 commits intomasterfrom
etag-master
Open

[pfc] Http Cache-Control Validation#89
alja wants to merge 16 commits intomasterfrom
etag-master

Conversation

@alja
Copy link
Copy Markdown
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

Comment thread src/XrdCl/XrdClFileSystem.hh
Comment thread src/XrdPfc/XrdPfcFile.cc
@alja
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/XrdCl/XrdClFileSystem.hh
Comment thread src/XrdOuc/XrdOucCache.hh


//------------------------------------------------------------------------------
//! Perform an fcntl() operation (defaults to passthrough).
Copy link
Copy Markdown
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.

Comment thread src/XrdPfc/XrdPfc.cc
Comment thread src/XrdPfc/XrdPfc.cc Outdated
Comment thread src/XrdPfc/XrdPfc.cc Outdated
XrdCl::QueryCode::Code queryCode = XrdCl::QueryCode::XAttr;
XrdCl::Buffer queryArgs(5);
std::string qs = std::to_string(queryCode);
queryArgs.FromString(qs);
Copy link
Copy Markdown
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.

Comment thread src/XrdPfc/XrdPfcFile.hh Outdated
Comment thread src/XrdPfc/XrdPfcFile.hh Outdated
Comment thread src/XrdPfc/XrdPfcFile.hh Outdated
Comment thread src/XrdPosix/XrdPosixFile.cc Outdated
Comment thread src/XrdPosix/XrdPosixPrepIO.hh Outdated
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.

2 participants