|
|
03b9a7 |
diff --git a/src/FwdState.cc b/src/FwdState.cc
|
|
|
03b9a7 |
index f16acd0..c1d8a0f 100644
|
|
|
03b9a7 |
--- a/src/FwdState.cc
|
|
|
03b9a7 |
+++ b/src/FwdState.cc
|
|
|
03b9a7 |
@@ -139,7 +139,6 @@ FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRe
|
|
|
03b9a7 |
start_t = squid_curtime;
|
|
|
03b9a7 |
serverDestinations.reserve(Config.forward_max_tries);
|
|
|
03b9a7 |
e->lock("FwdState");
|
|
|
03b9a7 |
- EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
// Called once, right after object creation, when it is safe to set self
|
|
|
03b9a7 |
@@ -250,7 +249,6 @@ FwdState::completed()
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
#endif
|
|
|
03b9a7 |
} else {
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
entry->complete();
|
|
|
03b9a7 |
entry->releaseRequest();
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
@@ -495,7 +493,6 @@ FwdState::complete()
|
|
|
03b9a7 |
debugs(17, 3, HERE << "server FD " << serverConnection()->fd << " not re-forwarding status " << entry->getReply()->sline.status());
|
|
|
03b9a7 |
else
|
|
|
03b9a7 |
debugs(17, 3, HERE << "server (FD closed) not re-forwarding status " << entry->getReply()->sline.status());
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
entry->complete();
|
|
|
03b9a7 |
|
|
|
03b9a7 |
if (!Comm::IsConnOpen(serverConn))
|
|
|
03b9a7 |
diff --git a/src/MemStore.cc b/src/MemStore.cc
|
|
|
03b9a7 |
index 86b6024..405b644 100644
|
|
|
03b9a7 |
--- a/src/MemStore.cc
|
|
|
03b9a7 |
+++ b/src/MemStore.cc
|
|
|
03b9a7 |
@@ -402,7 +402,6 @@ MemStore::copyFromShmSlice(StoreEntry &e, const StoreIOBuffer &buf, bool eof)
|
|
|
03b9a7 |
const int result = rep->httpMsgParseStep(mb.buf, buf.length, eof);
|
|
|
03b9a7 |
if (result > 0) {
|
|
|
03b9a7 |
assert(rep->pstate == psParsed);
|
|
|
03b9a7 |
- EBIT_CLR(e.flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
} else if (result < 0) {
|
|
|
03b9a7 |
debugs(20, DBG_IMPORTANT, "Corrupted mem-cached headers: " << e);
|
|
|
03b9a7 |
return false;
|
|
|
03b9a7 |
@@ -508,15 +507,9 @@ MemStore::startCaching(StoreEntry &e)
|
|
|
03b9a7 |
void
|
|
|
03b9a7 |
MemStore::copyToShm(StoreEntry &e)
|
|
|
03b9a7 |
{
|
|
|
03b9a7 |
- // prevents remote readers from getting ENTRY_FWD_HDR_WAIT entries and
|
|
|
03b9a7 |
- // not knowing when the wait is over
|
|
|
03b9a7 |
- if (EBIT_TEST(e.flags, ENTRY_FWD_HDR_WAIT)) {
|
|
|
03b9a7 |
- debugs(20, 5, "postponing copying " << e << " for ENTRY_FWD_HDR_WAIT");
|
|
|
03b9a7 |
- return;
|
|
|
03b9a7 |
- }
|
|
|
03b9a7 |
-
|
|
|
03b9a7 |
assert(map);
|
|
|
03b9a7 |
assert(e.mem_obj);
|
|
|
03b9a7 |
+ Must(!EBIT_TEST(e.flags, ENTRY_FWD_HDR_WAIT));
|
|
|
03b9a7 |
|
|
|
03b9a7 |
const int32_t index = e.mem_obj->memCache.index;
|
|
|
03b9a7 |
assert(index >= 0);
|
|
|
03b9a7 |
diff --git a/src/client_side_request.cc b/src/client_side_request.cc
|
|
|
03b9a7 |
index a824b08..5debc29 100644
|
|
|
03b9a7 |
--- a/src/client_side_request.cc
|
|
|
03b9a7 |
+++ b/src/client_side_request.cc
|
|
|
03b9a7 |
@@ -1919,7 +1919,6 @@ ClientHttpRequest::handleAdaptedHeader(HttpMsg *msg)
|
|
|
03b9a7 |
assert(repContext);
|
|
|
03b9a7 |
repContext->createStoreEntry(request->method, request->flags);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
- EBIT_CLR(storeEntry()->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
request_satisfaction_mode = true;
|
|
|
03b9a7 |
request_satisfaction_offset = 0;
|
|
|
03b9a7 |
storeEntry()->replaceHttpReply(new_rep);
|
|
|
03b9a7 |
diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc
|
|
|
03b9a7 |
index 9c78bbb..4f8319a 100644
|
|
|
03b9a7 |
--- a/src/clients/FtpGateway.cc
|
|
|
03b9a7 |
+++ b/src/clients/FtpGateway.cc
|
|
|
03b9a7 |
@@ -2309,7 +2309,6 @@ Ftp::Gateway::completedListing()
|
|
|
03b9a7 |
ferr.ftp.server_msg = ctrl.message;
|
|
|
03b9a7 |
ctrl.message = NULL;
|
|
|
03b9a7 |
entry->replaceHttpReply( ferr.BuildHttpReply() );
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
entry->flush();
|
|
|
03b9a7 |
entry->unlock("Ftp::Gateway");
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
@@ -2588,8 +2587,6 @@ Ftp::Gateway::appendSuccessHeader()
|
|
|
03b9a7 |
|
|
|
03b9a7 |
assert(entry->isEmpty());
|
|
|
03b9a7 |
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
-
|
|
|
03b9a7 |
entry->buffer(); /* released when done processing current data payload */
|
|
|
03b9a7 |
|
|
|
03b9a7 |
filename = (t = urlpath.rpos('/')) ? t + 1 : urlpath.termedBuf();
|
|
|
03b9a7 |
diff --git a/src/clients/FtpRelay.cc b/src/clients/FtpRelay.cc
|
|
|
03b9a7 |
index ed498b4..f1d4e9e 100644
|
|
|
03b9a7 |
--- a/src/clients/FtpRelay.cc
|
|
|
03b9a7 |
+++ b/src/clients/FtpRelay.cc
|
|
|
03b9a7 |
@@ -290,7 +290,6 @@ Ftp::Relay::failedErrorMessage(err_type error, int xerrno)
|
|
|
03b9a7 |
const Http::StatusCode httpStatus = failedHttpStatus(error);
|
|
|
03b9a7 |
HttpReply *const reply = createHttpReply(httpStatus);
|
|
|
03b9a7 |
entry->replaceHttpReply(reply);
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
fwd->request->detailError(error, xerrno);
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
@@ -373,7 +372,6 @@ void
|
|
|
03b9a7 |
Ftp::Relay::forwardReply()
|
|
|
03b9a7 |
{
|
|
|
03b9a7 |
assert(entry->isEmpty());
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
HttpReply *const reply = createHttpReply(Http::scNoContent);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
@@ -448,7 +446,6 @@ Ftp::Relay::startDataDownload()
|
|
|
03b9a7 |
" (" << data.conn->local << ")");
|
|
|
03b9a7 |
|
|
|
03b9a7 |
HttpReply *const reply = createHttpReply(Http::scOkay, -1);
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
setVirginReply(reply);
|
|
|
03b9a7 |
adaptOrFinalizeReply();
|
|
|
03b9a7 |
|
|
|
03b9a7 |
diff --git a/src/enums.h b/src/enums.h
|
|
|
03b9a7 |
index 4d04805..50199da 100644
|
|
|
03b9a7 |
--- a/src/enums.h
|
|
|
03b9a7 |
+++ b/src/enums.h
|
|
|
03b9a7 |
@@ -96,12 +96,31 @@ typedef enum {
|
|
|
03b9a7 |
enum {
|
|
|
03b9a7 |
ENTRY_SPECIAL,
|
|
|
03b9a7 |
ENTRY_REVALIDATE,
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
+ /// Tiny Store writes are likely. The writes should be aggregated together
|
|
|
03b9a7 |
+ /// before Squid announces the new content availability to the store
|
|
|
03b9a7 |
+ /// clients. For example, forming a cached HTTP response header may result
|
|
|
03b9a7 |
+ /// in dozens of StoreEntry::write() calls, many of which adding as little
|
|
|
03b9a7 |
+ /// as two bytes. Sharing those small writes with the store clients
|
|
|
03b9a7 |
+ /// increases overhead, especially because the client code can do nothing
|
|
|
03b9a7 |
+ /// useful with the written content until the whole response header is
|
|
|
03b9a7 |
+ /// stored. Might be combined with ENTRY_FWD_HDR_WAIT. TODO: Rename to
|
|
|
03b9a7 |
+ /// ENTRY_DELAY_WHILE_COALESCING to emphasize the difference from and
|
|
|
03b9a7 |
+ /// similarity with ENTRY_FWD_HDR_WAIT.
|
|
|
03b9a7 |
DELAY_SENDING,
|
|
|
03b9a7 |
RELEASE_REQUEST,
|
|
|
03b9a7 |
REFRESH_REQUEST,
|
|
|
03b9a7 |
ENTRY_CACHABLE_RESERVED_FOR_FUTURE_USE,
|
|
|
03b9a7 |
ENTRY_DISPATCHED,
|
|
|
03b9a7 |
KEY_PRIVATE,
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
+ /// The current entry response may change. The contents of an entry in this
|
|
|
03b9a7 |
+ /// state must not be shared with its store clients. For example, Squid
|
|
|
03b9a7 |
+ /// receives (and buffers) an HTTP/504 response but may decide to retry that
|
|
|
03b9a7 |
+ /// transaction to receive a successful response from another server
|
|
|
03b9a7 |
+ /// instead. Might be combined with DELAY_SENDING. TODO: Rename to
|
|
|
03b9a7 |
+ /// ENTRY_DELAY_WHILE_WOBBLING to emphasize the difference from and
|
|
|
03b9a7 |
+ /// similarity with DELAY_SENDING.
|
|
|
03b9a7 |
ENTRY_FWD_HDR_WAIT,
|
|
|
03b9a7 |
ENTRY_NEGCACHED,
|
|
|
03b9a7 |
ENTRY_VALIDATED,
|
|
|
03b9a7 |
diff --git a/src/gopher.cc b/src/gopher.cc
|
|
|
03b9a7 |
index d373e8a..6d4ab1e 100644
|
|
|
03b9a7 |
--- a/src/gopher.cc
|
|
|
03b9a7 |
+++ b/src/gopher.cc
|
|
|
03b9a7 |
@@ -233,7 +233,6 @@ gopherMimeCreate(GopherStateData * gopherState)
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
assert(entry->isEmpty());
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
HttpReply *reply = new HttpReply;
|
|
|
03b9a7 |
entry->buffer();
|
|
|
03b9a7 |
diff --git a/src/http.cc b/src/http.cc
|
|
|
03b9a7 |
index 1dd1e6d..08531dc 100644
|
|
|
03b9a7 |
--- a/src/http.cc
|
|
|
03b9a7 |
+++ b/src/http.cc
|
|
|
03b9a7 |
@@ -932,8 +932,8 @@ HttpStateData::haveParsedReplyHeaders()
|
|
|
03b9a7 |
|
|
|
03b9a7 |
if (vary.isEmpty()) {
|
|
|
03b9a7 |
entry->makePrivate();
|
|
|
03b9a7 |
- if (!fwd->reforwardableStatus(rep->sline.status()))
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
+ if (fwd->reforwardableStatus(rep->sline.status()))
|
|
|
03b9a7 |
+ EBIT_SET(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
varyFailure = true;
|
|
|
03b9a7 |
} else {
|
|
|
03b9a7 |
entry->mem_obj->vary_headers = vary;
|
|
|
03b9a7 |
@@ -945,8 +945,8 @@ HttpStateData::haveParsedReplyHeaders()
|
|
|
03b9a7 |
* If its not a reply that we will re-forward, then
|
|
|
03b9a7 |
* allow the client to get it.
|
|
|
03b9a7 |
*/
|
|
|
03b9a7 |
- if (!fwd->reforwardableStatus(rep->sline.status()))
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
+ if (fwd->reforwardableStatus(rep->sline.status()))
|
|
|
03b9a7 |
+ EBIT_SET(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
switch (cacheableReply()) {
|
|
|
03b9a7 |
|
|
|
03b9a7 |
diff --git a/src/ipc/Forwarder.cc b/src/ipc/Forwarder.cc
|
|
|
03b9a7 |
index bf3c428..116d6f0 100644
|
|
|
03b9a7 |
--- a/src/ipc/Forwarder.cc
|
|
|
03b9a7 |
+++ b/src/ipc/Forwarder.cc
|
|
|
03b9a7 |
@@ -94,8 +94,10 @@ Ipc::Forwarder::handleRemoteAck()
|
|
|
03b9a7 |
{
|
|
|
03b9a7 |
debugs(54, 3, HERE);
|
|
|
03b9a7 |
request->requestId = 0;
|
|
|
03b9a7 |
- // Do not clear ENTRY_FWD_HDR_WAIT or do entry->complete() because
|
|
|
03b9a7 |
- // it will trigger our client side processing. Let job cleanup close.
|
|
|
03b9a7 |
+ // Do not do entry->complete() because it will trigger our client side
|
|
|
03b9a7 |
+ // processing when we no longer own the client-Squid connection.
|
|
|
03b9a7 |
+ // Let job cleanup close the client-Squid connection that Coordinator
|
|
|
03b9a7 |
+ // now owns.
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
/// Ipc::Forwarder::requestTimedOut wrapper
|
|
|
03b9a7 |
diff --git a/src/mgr/Forwarder.cc b/src/mgr/Forwarder.cc
|
|
|
03b9a7 |
index 3c4e4f3..7d33a9b 100644
|
|
|
03b9a7 |
--- a/src/mgr/Forwarder.cc
|
|
|
03b9a7 |
+++ b/src/mgr/Forwarder.cc
|
|
|
03b9a7 |
@@ -37,7 +37,6 @@ Mgr::Forwarder::Forwarder(const Comm::ConnectionPointer &aConn, const ActionPara
|
|
|
03b9a7 |
|
|
|
03b9a7 |
HTTPMSGLOCK(httpRequest);
|
|
|
03b9a7 |
entry->lock("Mgr::Forwarder");
|
|
|
03b9a7 |
- EBIT_SET(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
closer = asyncCall(16, 5, "Mgr::Forwarder::noteCommClosed",
|
|
|
03b9a7 |
CommCbMemFunT<Forwarder, CommCloseCbParams>(this, &Forwarder::noteCommClosed));
|
|
|
03b9a7 |
@@ -122,7 +121,6 @@ Mgr::Forwarder::sendError(ErrorState *error)
|
|
|
03b9a7 |
Must(entry != NULL);
|
|
|
03b9a7 |
Must(httpRequest != NULL);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
- EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
entry->buffer();
|
|
|
03b9a7 |
entry->replaceHttpReply(error->BuildHttpReply());
|
|
|
03b9a7 |
entry->expires = squid_curtime;
|
|
|
03b9a7 |
diff --git a/src/store.cc b/src/store.cc
|
|
|
03b9a7 |
index cbb2676..c5ae817 100644
|
|
|
03b9a7 |
--- a/src/store.cc
|
|
|
03b9a7 |
+++ b/src/store.cc
|
|
|
03b9a7 |
@@ -831,8 +831,12 @@ StoreEntry::write (StoreIOBuffer writeBuffer)
|
|
|
03b9a7 |
storeGetMemSpace(writeBuffer.length);
|
|
|
03b9a7 |
mem_obj->write(writeBuffer);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
- if (!EBIT_TEST(flags, DELAY_SENDING))
|
|
|
03b9a7 |
- invokeHandlers();
|
|
|
03b9a7 |
+ if (EBIT_TEST(flags, ENTRY_FWD_HDR_WAIT) && !mem_obj->readAheadPolicyCanRead()) {
|
|
|
03b9a7 |
+ debugs(20, 3, "allow Store clients to get entry content after buffering too much for " << *this);
|
|
|
03b9a7 |
+ EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
+ }
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
+ invokeHandlers();
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
/* Append incoming data from a primary server to an entry. */
|
|
|
03b9a7 |
@@ -1047,6 +1051,9 @@ StoreEntry::complete()
|
|
|
03b9a7 |
{
|
|
|
03b9a7 |
debugs(20, 3, "storeComplete: '" << getMD5Text() << "'");
|
|
|
03b9a7 |
|
|
|
03b9a7 |
+ // To preserve forwarding retries, call FwdState::complete() instead.
|
|
|
03b9a7 |
+ EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
if (store_status != STORE_PENDING) {
|
|
|
03b9a7 |
/*
|
|
|
03b9a7 |
* if we're not STORE_PENDING, then probably we got aborted
|
|
|
03b9a7 |
@@ -1103,6 +1110,9 @@ StoreEntry::abort()
|
|
|
03b9a7 |
|
|
|
03b9a7 |
EBIT_SET(flags, ENTRY_ABORTED);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
+ // allow the Store clients to be told about the problem
|
|
|
03b9a7 |
+ EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
setMemStatus(NOT_IN_MEMORY);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
store_status = STORE_OK;
|
|
|
03b9a7 |
@@ -1890,7 +1900,6 @@ StoreEntry::startWriting()
|
|
|
03b9a7 |
|
|
|
03b9a7 |
rep->packHeadersInto(&p);
|
|
|
03b9a7 |
mem_obj->markEndOfReplyHeaders();
|
|
|
03b9a7 |
- EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
rep->body.packInto(&p);
|
|
|
03b9a7 |
|
|
|
03b9a7 |
diff --git a/src/store_client.cc b/src/store_client.cc
|
|
|
03b9a7 |
index 07a05d4..7ee1b10 100644
|
|
|
03b9a7 |
--- a/src/store_client.cc
|
|
|
03b9a7 |
+++ b/src/store_client.cc
|
|
|
03b9a7 |
@@ -282,11 +282,6 @@ storeClientCopy2(StoreEntry * e, store_client * sc)
|
|
|
03b9a7 |
return;
|
|
|
03b9a7 |
}
|
|
|
03b9a7 |
|
|
|
03b9a7 |
- if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) {
|
|
|
03b9a7 |
- debugs(90, 5, "storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set");
|
|
|
03b9a7 |
- return;
|
|
|
03b9a7 |
- }
|
|
|
03b9a7 |
-
|
|
|
03b9a7 |
if (sc->flags.store_copying) {
|
|
|
03b9a7 |
sc->flags.copy_event_pending = true;
|
|
|
03b9a7 |
debugs(90, 3, "storeClientCopy2: Queueing storeClientCopyEvent()");
|
|
|
03b9a7 |
@@ -720,6 +715,15 @@ storeUnregister(store_client * sc, StoreEntry * e, void *data)
|
|
|
03b9a7 |
void
|
|
|
03b9a7 |
StoreEntry::invokeHandlers()
|
|
|
03b9a7 |
{
|
|
|
03b9a7 |
+ if (EBIT_TEST(flags, DELAY_SENDING)) {
|
|
|
03b9a7 |
+ debugs(90, 3, "DELAY_SENDING is on, exiting " << *this);
|
|
|
03b9a7 |
+ return;
|
|
|
03b9a7 |
+ }
|
|
|
03b9a7 |
+ if (EBIT_TEST(flags, ENTRY_FWD_HDR_WAIT)) {
|
|
|
03b9a7 |
+ debugs(90, 3, "ENTRY_FWD_HDR_WAIT is on, exiting " << *this);
|
|
|
03b9a7 |
+ return;
|
|
|
03b9a7 |
+ }
|
|
|
03b9a7 |
+
|
|
|
03b9a7 |
/* Commit what we can to disk, if appropriate */
|
|
|
03b9a7 |
swapOut();
|
|
|
03b9a7 |
int i = 0;
|