-
Notifications
You must be signed in to change notification settings - Fork 166
Implement max-age directive
#1957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
abh3
left a comment
There was a problem hiding this 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)?
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>
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>
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>
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>
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>
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>
|
Closing this one out -- Alja has been picking up where I've left off in separate PRs. |
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-agedirective, 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
Unlinkrequest 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.