Skip to content

Conversation

@bbockelm
Copy link
Collaborator

This is the third PR in the series (to be reviewed after #1953 and #1954; it'll be rebased on top of whatever those become).

This implements the HTTP max-age directive, allowing the client to control how old the data returned can be. If the cached copy is over the age threshold, either the PFC will delete it (if the file is being opened for the first time) or the HTTP request will (for files that are already opened by other clients).

This will need the most careful feedback from @osschar as it contains a key improvement for the XrdPfc -- an Unlink request no longer invalidates all open file handles but rather the next read will cause it to be reopened.

Note the careful cleanup of the HTTP GET state machine -- now each request state represents a unique operation instead of overloading the request state with other pieces of information. I also tried to add some more careful comments to the state machine to try and make it more understandable by the next developer.

The HTTP `cache-control` header has a well-defined set of potential
values.  This helper class will allow us to central its parsing.
This provides the PFC with the ability to parse the `cache-control`
CGI, using the XrdOucCacheDirective helper class, and understand
the no-store and no-cache directives.

*Note* this handles the simple cases only -- if the file in the
cache was already opened by another client then we will serve from that
file according to the original open rules.
With this, clients will receive the RFC standard 504 Gateway Timeout
if the file is not already cached.

This subtly changes the semantics of the creation time in the cinfo
file to be when the first block of data is written as opposed to when
the cinfo is created (as opening but not reading the file will create
the cinfo file).
This allows the client to specify the maximum age of the cached data
they are willing to accept.

This currently only works for the first attach of the data.
Previously, an Unlink of a file that was opened would cause a failure
on future file reads.
Permits an invalidation of the cache without trying to delete the
path from upstream as well.
With this, the HTTP server can invalidate the cache after it has
opened a file if the file proves to be older than the requested
max-age.

A side-effect is refactoring the state machine to be simpler -- for
GET, each request state has a single operation that may occur.
Copy link
Member

@abh3 abh3 left a comment

Choose a reason for hiding this comment

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

OK, I have looked at this and I cannot say I am happy. This is not what we have traditionally doe visive the architecture. The approach here is rather invasive as it tries to force the whole http header protocol all the way through the end-point code. That really is not what we want to do. In general, we have always promoted headers to cgi elements. In this case, one would need to promote header sub-elements to cgi elements. We then do not pollute the code with specific syntax requirements, Additionally, the protocol gets to choose what actually gets exposed and it's all done in a way that is transparent. I know you spent a lot of work here (obviously) but the approach is really not the way to go as it really muddles the code.

I also see that you better structured the http state machine. That was a good thing. Unfortunately, it's totally tied up with this feature patch. They really should be sperate changes. Could we start with that (i.e. fixing the http state machine)?

smithdh added a commit to smithdh/xrootd that referenced this pull request Aug 17, 2023
This change was mostly extracted from a larger pull request that
included other features, xrootd#1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
smithdh added a commit to smithdh/xrootd that referenced this pull request Sep 5, 2023
This change was mostly extracted from a larger pull request that
included other features, xrootd#1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
smithdh added a commit to smithdh/xrootd that referenced this pull request Sep 6, 2023
This change was mostly extracted from a larger pull request that
included other features, xrootd#1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
smithdh added a commit to smithdh/xrootd that referenced this pull request Sep 11, 2023
This change was mostly extracted from a larger pull request that
included other features, xrootd#1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
smithdh added a commit to smithdh/xrootd that referenced this pull request Sep 14, 2023
This change was mostly extracted from a larger pull request that
included other features, xrootd#1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
amadio pushed a commit that referenced this pull request Sep 15, 2023
This change was mostly extracted from a larger pull request that
included other features, #1957. The current change aims to be
a minimal refactor in preparation for other work in the same area
of the code.

Co-authored-by: Brian Bockelman <bbockelman@morgridge.org>
@bbockelm
Copy link
Collaborator Author

Closing this one out -- Alja has been picking up where I've left off in separate PRs.

@bbockelm bbockelm closed this Feb 13, 2024
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