]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merged from trunk 13172.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 6 Dec 2013 23:52:26 +0000 (16:52 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 6 Dec 2013 23:52:26 +0000 (16:52 -0700)
49 files changed:
1  2 
src/DiskIO/IpcIo/IpcIoFile.cc
src/FwdState.cc
src/Makefile.am
src/MemBlob.cc
src/MemBlob.h
src/MemObject.cc
src/Server.cc
src/SquidConfig.h
src/StoreMetaURL.cc
src/StoreSwapLogData.h
src/acl/Asn.cc
src/cf.data.pre
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/enums.h
src/errorpage.cc
src/format/Format.cc
src/fs/Makefile.am
src/fs/rock/RockIoState.cc
src/fs/rock/RockRebuild.cc
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/fs/ufs/UFSStoreState.cc
src/fs/ufs/UFSSwapDir.cc
src/ftp.cc
src/http.cc
src/ipc/Queue.h
src/ipc/ReadWriteLock.cc
src/ipc/StoreMap.cc
src/ipc/StoreMap.h
src/ipc/Strand.cc
src/mgr/Forwarder.cc
src/neighbors.cc
src/peer_digest.cc
src/peer_select.cc
src/refresh.cc
src/stat.cc
src/store.cc
src/store_client.cc
src/store_dir.cc
src/store_log.cc
src/store_rebuild.cc
src/store_swapout.cc
src/tests/stub_MemObject.cc
src/tests/stub_store.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc
src/whois.cc

Simple merge
diff --cc src/FwdState.cc
Simple merge
diff --cc src/Makefile.am
index 2998bf13989c3999e7bde66fadca2b65a0b9ae1a,9595c5c7ac0d3d08106f05e774ea6cc923320c90..87d14167afa3606d07abfbf53dd6f60846560a13
@@@ -1569,11 -1559,8 +1563,9 @@@ tests_testCacheManager_SOURCES = 
        StoreSwapLogData.cc \
        tools.h \
        tools.cc \
-       tunnel.cc \
-       SwapDir.cc \
 +      Transients.cc \
+       tests/stub_tunnel.cc \
+       tests/stub_SwapDir.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
        url.cc \
@@@ -2005,8 -1988,7 +1993,8 @@@ tests_testEvent_SOURCES = 
        time.cc \
        tools.h \
        tools.cc \
-       tunnel.cc \
 +      Transients.cc \
+       tests/stub_tunnel.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
        url.cc \
@@@ -2256,8 -2234,7 +2240,8 @@@ tests_testEventLoop_SOURCES = 
        time.cc \
        tools.h \
        tools.cc \
-       tunnel.cc \
 +      Transients.cc \
+       tests/stub_tunnel.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
        url.cc \
@@@ -2785,9 -2753,8 +2761,9 @@@ tests_testHttpRequest_SOURCES = 
        event.cc \
        tools.h \
        tools.cc \
-       tunnel.cc \
-       SwapDir.cc \
 +      Transients.cc \
+       tests/stub_tunnel.cc \
+       tests/stub_SwapDir.cc \
        MemStore.cc \
        url.cc \
        URLScheme.cc \
@@@ -3264,9 -3227,7 +3236,9 @@@ testRefCount_LDADD = 
  tests_testRock_SOURCES = \
        cbdata.cc \
        CacheDigest.h \
-       CacheDigest.cc \
 +      CollapsedForwarding.h \
 +      CollapsedForwarding.cc \
+       tests/stub_CacheDigest.cc \
        ConfigOption.cc \
        ConfigParser.cc \
        disk.h \
@@@ -3767,8 -3557,7 +3570,8 @@@ tests_testURL_SOURCES = 
        String.cc \
        StrList.h \
        StrList.cc \
-       SwapDir.cc \
 +      Transients.cc \
+       tests/stub_SwapDir.cc \
        MemStore.cc \
        tests/stub_debug.cc \
        tests/stub_DiskIOModule.cc \
diff --cc src/MemBlob.cc
Simple merge
diff --cc src/MemBlob.h
Simple merge
index b38cbb680578ca89676a85f85be86cfaa82aa0f9,7e403697a4d693561de3c1fa50ab12ba97136c30..851943c2292c915d31f2a6a7da9ec5477f489293
@@@ -74,49 -74,30 +74,49 @@@ MemObject::inUseCount(
      return Pool().inUseCount();
  }
  
 -void
 -MemObject::resetUrls(char const *aUrl, char const *aLog_url)
 -{
 -    safe_free(url);
 -    safe_free(log_url);    /* XXX account log_url */
 -    log_url = xstrdup(aLog_url);
 -    url = xstrdup(aUrl);
 +const char *
 +MemObject::storeId() const {
-     if (!storeId_.defined()) {
++    if (!storeId_.size()) {
 +        debugs(20, DBG_IMPORTANT, "Bug: Missing MemObject::storeId value");
 +        dump();
 +        storeId_ = "[unknown_URI]";
 +    }
 +    return storeId_.termedBuf();
  }
  
 -MemObject::MemObject(char const *aUrl, char const *aLog_url)
 -{
 -    debugs(20, 3, HERE << "new MemObject " << this);
 -    _reply = new HttpReply;
 -    HTTPMSGLOCK(_reply);
 +const char *
 +MemObject::logUri() const {
-     return logUri_.defined() ? logUri_.termedBuf() : storeId();
++    return logUri_.size() ? logUri_.termedBuf() : storeId();
 +}
  
 -    url = xstrdup(aUrl);
 +bool
 +MemObject::hasUris() const {
-     return storeId_.defined();
++    return storeId_.size();
 +}
  
 -#if URL_CHECKSUM_DEBUG
 +void
 +MemObject::setUris(char const *aStoreId, char const *aLogUri, const HttpRequestMethod &aMethod)
 +{
 +    storeId_ = aStoreId;
  
 -    chksum = url_checksum(url);
 +    // fast pointer comparison for a common storeCreateEntry(url,url,...) case
 +    if (!aLogUri || aLogUri == aStoreId) 
 +        logUri_.clean(); // use storeId_ by default to minimize copying
 +    else
 +        logUri_ = aLogUri;
  
 +    method = aMethod;
 +
 +#if URL_CHECKSUM_DEBUG
 +    chksum = url_checksum(urlXXX());
  #endif
 +}
  
 -    log_url = xstrdup(aLog_url);
 +MemObject::MemObject(): smpCollapsed(false)
 +{
 +    debugs(20, 3, HERE << "new MemObject " << this);
 +    _reply = new HttpReply;
 +    HTTPMSGLOCK(_reply);
  
      object_sz = -1;
  
diff --cc src/Server.cc
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/acl/Asn.cc
index a401101edbb15ae66a64d6f7aac340244674e2ca,5ef8091232eec75a98c684fac8484c55000b06a0..33062e8aba4e2ca8d1ae9c6d70282bc15ffdcc2e
@@@ -98,8 -103,31 +103,31 @@@ public
      int reqofs;
      char reqbuf[AS_REQBUF_SZ];
      bool dataRead;
+ private:
+     CBDATA_CLASS2(ASState);
  };
  
 -    entry->unlock();
+ CBDATA_CLASS_INIT(ASState);
+ ASState::ASState() :
+         entry(NULL),
+         sc(NULL),
+         request(NULL),
+         as_number(0),
+         offset(0),
+         reqofs(0),
+         dataRead(false)
+ {
+     memset(reqbuf, 0, AS_REQBUF_SZ);
+ }
+ ASState::~ASState()
+ {
+     debugs(53, 3, entry->url());
+     storeUnregister(sc, entry, this);
++    entry->unlock("~ASState");
+ }
  /** entry into the radix tree */
  struct rtentry_t {
      struct squid_radix_node e_nodes[2];
@@@ -250,9 -271,9 +271,9 @@@ asnCacheStart(int as
      if ((e = storeGetPublic(asres, Http::METHOD_GET)) == NULL) {
          e = storeCreateEntry(asres, asres, RequestFlags(), Http::METHOD_GET);
          asState->sc = storeClientListAdd(e, asState);
-         FwdState::fwdStart(Comm::ConnectionPointer(), e, asState->request);
+         FwdState::fwdStart(Comm::ConnectionPointer(), e, asState->request.getRaw());
      } else {
 -        e->lock();
 +        e->lock("Asn");
          asState->sc = storeClientListAdd(e, asState);
      }
  
diff --cc src/cf.data.pre
index 67c17e5b390eea4f521c4e72a8d851a844a0df60,533b726ac62ede80062fdde2b7e6ea4c11463f48..60fcd335f0fb20c4848fa93f605cc39880786ea5
@@@ -3423,36 -3475,7 +3467,17 @@@ DOC_STAR
        and when set to zero, disables the disk I/O rate limit
        enforcement. Currently supported by IpcIo module only.
  
 +      slot-size=bytes: The size of a database "record" used for
 +      storing cached responses. A cached response occupies at least
 +      one slot and all database I/O is done using individual slots so
 +      increasing this parameter leads to more disk space waste while
 +      decreasing it leads to more disk I/O overheads. Should be a
 +      multiple of your operating system I/O page size. Defaults to
 +      16KBytes. A housekeeping header is stored with each slot and
 +      smaller slot-sizes will be rejected. The header is smaller than
 +      100 bytes.
 +
  
-       ====  The coss store type  ====
-       NP: COSS filesystem in Squid-3 has been deemed too unstable for
-           production use and has thus been removed from this release.
-           We hope that it can be made usable again soon.
-       block-size=n defines the "block size" for COSS cache_dir's.
-       Squid uses file numbers as block numbers.  Since file numbers
-       are limited to 24 bits, the block size determines the maximum
-       size of the COSS partition.  The default is 512 bytes, which
-       leads to a maximum cache_dir size of 512<<24, or 8 GB.  Note
-       you should not change the coss block size after Squid
-       has written some objects to the cache_dir.
-       The coss file store has changed from 2.5. Now it uses a file
-       called 'stripe' in the directory names in the config - and
-       this will be created by squid -z.
        ==== COMMON OPTIONS ====
  
        no-store        no new objects should be stored to this cache_dir.
Simple merge
Simple merge
Simple merge
diff --cc src/enums.h
Simple merge
Simple merge
index e737280e8e572cd44ef8f2aa76d5fdd47cecea59,15bef5e86888653fdc37ea975699f4f1edcf4989..79a19ef5cd0f89bd9166cf663c3d1ae75d45ac8b
@@@ -495,6 -495,13 +495,13 @@@ Format::Format::assemble(MemBuf &mb, co
  
          break;
  
 -            snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero && (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0, al->cache.start_time.tv_sec, precision, (int)(al->cache.start_time.tv_usec / fmt->divisor));
+         case LFT_TIME_START: {
+             int precision = fmt->widthMax >=0 ? fmt->widthMax : 3;
++            snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero && (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0, (int64_t)al->cache.start_time.tv_sec, precision, (int)(al->cache.start_time.tv_usec / fmt->divisor));
+             out = tmp;
+         }
+             break;
          case LFT_TIME_TO_HANDLE_REQUEST:
              outint = al->cache.msec;
              doint = 1;
Simple merge
index 4ee24ac55c31e3b5749eb377d1f8a4a9d7bb4780,8190f28e9c10c2c2f7361c239601e4820477b084..f1841617dc09e6ddcfdfc85e83e9c6a4bca7b3dd
@@@ -3,21 -3,17 +3,21 @@@
   */
  
  #include "squid.h"
- #include "CollapsedForwarding.h"
 +#include "base/TextException.h"
++#include "CollapsedForwarding.h"
  #include "DiskIO/DiskIOModule.h"
  #include "DiskIO/DiskIOStrategy.h"
  #include "DiskIO/WriteRequest.h"
- #include "fs/rock/RockIoState.h"
  #include "fs/rock/RockIoRequests.h"
+ #include "fs/rock/RockIoState.h"
  #include "fs/rock/RockSwapDir.h"
  #include "globals.h"
- #include "MemObject.h"
 +#include "Mem.h"
+ #include "MemObject.h"
  #include "Parsing.h"
 +#include "Transients.h"
  
 -Rock::IoState::IoState(SwapDir *dir,
 +Rock::IoState::IoState(Rock::SwapDir::Pointer &aDir,
                         StoreEntry *anEntry,
                         StoreIOState::STFNCB *cbFile,
                         StoreIOState::STIOCB *cbIo,
index 454bf006522ad8db83da0c8e63ea320d51dd0c86,aca7d890591e9bbd0f7f20935089576ce3c0c310..0457cabae0191a5f67438a8ea6e38ad77aa840fb
@@@ -4,16 -4,15 +4,16 @@@
  
  #include "squid.h"
  #include "disk.h"
+ #include "fs/rock/RockDbCell.h"
  #include "fs/rock/RockRebuild.h"
  #include "fs/rock/RockSwapDir.h"
- #include "fs/rock/RockDbCell.h"
- #include "ipc/StoreMap.h"
  #include "globals.h"
++#include "ipc/StoreMap.h"
  #include "md5.h"
- #include "tools.h"
- #include "typedefs.h"
  #include "SquidTime.h"
  #include "store_rebuild.h"
+ #include "tools.h"
+ #include "typedefs.h"
  
  #if HAVE_ERRNO_H
  #include <errno.h>
Simple merge
index 1a77a2085551e659d278ae1b10bbf77b87904724,00cb22ca87beb4e5c589fe5411eb08bf5e095524..2a844ae694fb669529d34dfa56516a0fef929a8d
@@@ -4,11 -4,8 +4,11 @@@
  #include "DiskIO/DiskFile.h"
  #include "DiskIO/IORequestor.h"
  #include "fs/rock/RockDbCell.h"
 +#include "fs/rock/RockForward.h"
  #include "ipc/StoreMap.h"
 +#include "ipc/mem/Page.h"
 +#include "ipc/mem/PageStack.h"
+ #include "SwapDir.h"
  
  class DiskIOStrategy;
  class ReadRequest;
Simple merge
Simple merge
diff --cc src/ftp.cc
Simple merge
diff --cc src/http.cc
index 1409a905fb1da1b981e869bf3b9b5a4a8b313dbd,99773d74f7c29cb5a7687f4735bb9abbb0770bb3..e7f853106b070babb1bc4d516a20de21ca1999a3
@@@ -919,12 -910,9 +919,9 @@@ HttpStateData::haveParsedReplyHeaders(
  {
      ServerStateData::haveParsedReplyHeaders();
  
 -    Ctx ctx = ctx_enter(entry->mem_obj->url);
 +    Ctx ctx = ctx_enter(entry->mem_obj->urlXXX());
      HttpReply *rep = finalReply();
  
-     if (rep->sline.status() == Http::scPartialContent && rep->content_range)
-         currentOffset = rep->content_range->spec.offset;
      entry->timestampsSet();
  
      /* Check if object is cacheable or not based on reply code */
diff --cc src/ipc/Queue.h
Simple merge
Simple merge
Simple merge
Simple merge
index 10dc1befd1e5d396c755767f534b9879229740ce,f6939b4b5ed418efb73c8c9b3dc0a2f67e9fdd75..20c57236f3dd421f434d052293679bde605cc14a
@@@ -6,20 -6,19 +6,20 @@@
  #include "squid.h"
  #include "base/Subscription.h"
  #include "base/TextException.h"
+ #include "CacheManager.h"
++#include "CollapsedForwarding.h"
  #include "comm/Connection.h"
  #include "globals.h"
- #include "ipc/Strand.h"
- #include "ipc/StrandCoord.h"
+ #include "ipc/Kids.h"
  #include "ipc/Messages.h"
  #include "ipc/SharedListen.h"
+ #include "ipc/Strand.h"
+ #include "ipc/StrandCoord.h"
  #include "ipc/StrandSearch.h"
- #include "ipc/Kids.h"
+ #include "mgr/Forwarder.h"
  #include "mgr/Request.h"
  #include "mgr/Response.h"
- #include "mgr/Forwarder.h"
  #include "SwapDir.h" /* XXX: scope boundary violation */
- #include "CacheManager.h"
- #include "CollapsedForwarding.h"
  #if USE_DISKIO_IPCIO
  #include "DiskIO/IpcIo/IpcIoFile.h" /* XXX: scope boundary violation */
  #endif
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/refresh.cc
Simple merge
diff --cc src/stat.cc
Simple merge
diff --cc src/store.cc
Simple merge
index 87c111a824016aebb7d3acce20bd827d6b346296,b990e385c21118f26c8a3f4d6bb27075344fa403..092402094f42fcf5c2c88b5add53eb30c2ccadb5
@@@ -260,38 -260,35 +260,40 @@@ store_client::copy(StoreEntry * anEntry
  #if USE_ADAPTATION
      anEntry->kickProducer();
  #endif
 -    anEntry->unlock(); // after the "++enEntry->lock_count" above
 +    anEntry->unlock("store_client::copy");
+     // Add no code here. This object may no longer exist.
  }
  
 -/*
 - * This function is used below to decide if we have any more data to
 - * send to the client.  If the store_status is STORE_PENDING, then we
 - * do have more data to send.  If its STORE_OK, then
 - * we continue checking.  If the object length is negative, then we
 - * don't know the real length and must open the swap file to find out.
 - * If the length is >= 0, then we compare it to the requested copy
 - * offset.
 - */
 -static int
 -storeClientNoMoreToSend(StoreEntry * e, store_client * sc)
 +/// Whether there is (or will be) more entry data for us.
 +bool
 +store_client::moreToSend() const
  {
 -    int64_t len;
 +    if (entry->store_status == STORE_PENDING)
 +        return true; // there may be more coming
  
 -    if (e->store_status == STORE_PENDING)
 -        return 0;
 +    /* STORE_OK, including aborted entries: no more data is coming */
  
 -    if ((len = e->objectLen()) < 0)
 -        return 0;
 +    const int64_t len = entry->objectLen();
  
 -    if (sc->copyInto.offset < len)
 -        return 0;
 +    // If we do not know the entry length, then we have to open the swap file,
 +    // which is only possible if there is one AND if we are allowed to use it.
 +    const bool canSwapIn = entry->swap_filen >= 0 &&
 +                           getType() == STORE_DISK_CLIENT;
 +    if (len < 0)
 +        return canSwapIn;
  
 -    return 1;
 +    if (copyInto.offset >= len)
 +        return false; // sent everything there is
 +
 +    if (canSwapIn)
 +        return true; // if we lack prefix, we can swap it in
 +
 +    // If we cannot swap in, make sure we have what we want in RAM. Otherwise,
 +    // scheduleRead calls scheduleDiskRead which asserts on STORE_MEM_CLIENTs.
 +    const MemObject *mem = entry->mem_obj;
 +    return mem &&
 +        mem->inmem_lo <= copyInto.offset && copyInto.offset < mem->endOffset();
  }
  
  static void
index 5507e8052468c0d409407f41dcbbea5a0d243caa,cade545757edb10547f340169b5bdcfb64297768..009f0424ecb18788ef9bbac62c85cde3c739abc3
  #include "Store.h"
  #include "store_key_md5.h"
  #include "StoreHashIndex.h"
- #include "SwapDir.h"
  #include "swap_log_op.h"
+ #include "SwapDir.h"
  #include "tools.h"
 +#include "Transients.h"
  
  #if HAVE_STATVFS
  #if HAVE_SYS_STATVFS_H
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/whois.cc
index d5f61562302b5abbe8ba81953888ebf853b43ac5,2d98a334381112ab21d88c6a38d692db91fedd64..4f5201611b3079f09b2b57810fa7ca0b708a8d0e
@@@ -204,6 -198,6 +197,6 @@@ whoisClose(const CommCloseCbParams &par
  {
      WhoisState *p = (WhoisState *)params.data;
      debugs(75, 3, "whoisClose: FD " << params.fd);
 -    p->entry->unlock();
 +    p->entry->unlock("whoisClose");
-     cbdataFree(p);
+     delete p;
  }