-
Notifications
You must be signed in to change notification settings - Fork 531
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
Treat responses to collapsed requests as fresh #1927
Changes from all commits
55d2db0
3e3ac66
bbf929b
6713af8
8821a14
a849892
00df0d7
4db163d
9594244
9fc1ed5
4daec7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -627,7 +627,7 @@ clientReplyContext::cacheHit(const StoreIOBuffer result) | |
http->updateLoggingTags(LOG_TCP_MISS); | ||
processMiss(); | ||
return; | ||
} else if (!r->flags.internal && refreshCheckHTTP(e, r)) { | ||
} else if (!r->flags.internal && !didCollapse && refreshCheckHTTP(e, r)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current implementation requires this refreshCheckHTTP() and other indirect refreshCheck() callers to remember to check StoreClient::didCollapse member. We should embed that check, so that it cannot be forgotten! Doing so requires adding a pure virtual StoreClient::refreshCheck() method and moving Foo-specific refreshCheckFoo() functions into its overrides. The latter, in turn, requires some refresh.h API refactoring. All that is outside this small PR scope. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about adding a TODO or XXX to that effect? PR comments are bound to be forgotten There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done in commit 9fc1ed5.
Yes, but a much bigger problem, in my experience, is that C++ comments like that often trigger negative votes and associated overheads, especially in areas where the existing code is quite messed up, obscuring underlying problems and proper solutions. C++ comments are also bound to become stale and, hence, misleading. That is why I only added two minimal C++ TODO/XXX comments and kept the rest of the discussion to PR comments. Let's hope it is going to be different this time. |
||
debugs(88, 5, "clientCacheHit: in refreshCheck() block"); | ||
/* | ||
* We hold a stale copy; it needs to be validated | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -981,10 +981,10 @@ htcpSpecifier::checkHit() | |
debugs(31, 3, "NO; public object not found"); | ||
} else if (!e->validToSend()) { | ||
debugs(31, 3, "NO; entry not valid to send" ); | ||
} else if (refreshCheckHTCP(e, checkHitRequest.getRaw())) { | ||
debugs(31, 3, "NO; cached response is stale"); | ||
} else if (e->hittingRequiresCollapsing() && !startCollapsingOn(*e, false)) { | ||
debugs(31, 3, "NO; prohibited CF hit: " << *e); | ||
} else if (!didCollapse && refreshCheckHTCP(e, checkHitRequest.getRaw())) { | ||
debugs(31, 3, "NO; cached response is stale"); | ||
Comment on lines
-984
to
+987
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Git diff does not make this obvious, but this PR reorders HTCP and ICP freshness check steps to use didCollapse member (set during startCollapsingOn() step) for avoiding refreshCheck*() step. This reordering should not have a significant effect in most cases because hittingRequiresCollapsing() quickly returns false for most transactions. In rare/exceptional collapsed forwarding cases, the new computation order may be slower (both checks may perform configuration-dependent ACL or ACL-like computations), but it is a fair price to pay for avoiding revalidation transactions in those cases. |
||
} else { | ||
debugs(31, 3, "YES!?"); | ||
hit = e; | ||
|
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.
A single clientReplyContext::didCollapse member cannot distinguish which request (initial or refresh) got collapsed. Code "works" because the new member is ignored by refresh transactions -- they do not consult refreshCheckHTTP() -- but this ambiguity is a design defect.
Fixing this requires merging store_client class into StoreClient class (I added a TODO about that) while refactoring clientReplyContext to move initial and refresh fetching code into two distinct/dedicated classes, each derived from the merged StoreClient class (instead of current complex/error-prone saveState() and restoreState() hacks that use the same classes for both fetches). That complex refactoring is outside this small PR scope, but I hope to be able to do it in the foreseeable future.