This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3981947  Removes remnants of streams cache
3981947 is described below

commit 3981947b71f030b54a64d420093d535893832a0d
Author: Leif Hedstrom <[email protected]>
AuthorDate: Wed Apr 18 20:15:30 2018 -0600

    Removes remnants of streams cache
    
    This is still WIP, looking for feedback here if this is something we
    want to do. I noticed this "dead" code while looking for something else,
    so I personally think we should do it.
    
    If we agree to nuke this, I'll cleanup the ToDo's.
---
 .../cache-architecture/data-structures.en.rst      |  4 --
 iocore/cache/Cache.cc                              | 46 ++--------------------
 iocore/cache/CacheHosting.cc                       | 15 +++----
 iocore/cache/P_CacheHosting.h                      |  6 +--
 iocore/cache/P_CacheInternal.h                     |  1 -
 5 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index 40a2734..09355c7 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -455,10 +455,6 @@ Data Structures
 
        Total number of volumes scpecified in volume.config for HTTP scheme
 
-    .. member:: int num_stream_volumes
-
-       Total number of volumes scpecified in volume.config for stream
-
     .. member:: Queue<ConfigVol> cp_queue
 
 .. class:: Cache
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 6acb1e7..5c085e6 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -88,7 +88,6 @@ int cache_config_compatibility_4_2_0_fixup = 1;
 // Globals
 
 RecRawStatBlock *cache_rsb = nullptr;
-Cache *theStreamCache      = nullptr;
 Cache *theCache            = nullptr;
 CacheDisk **gdisks         = nullptr;
 int gndisks                = 0;
@@ -630,9 +629,6 @@ CacheProcessor::start_internal(int flags)
 
     ink_strlcpy(path, sd->pathname, sizeof(path));
     if (!sd->file_pathname) {
-      if (config_volumes.num_http_volumes && 
config_volumes.num_stream_volumes) {
-        Warning("It is suggested that you use raw disks if streaming and http 
are in the same cache");
-      }
       ink_strlcat(path, "/cache.db", sizeof(path));
       opts |= O_CREAT;
     }
@@ -864,12 +860,6 @@ CacheProcessor::diskInitialized()
       theCache->scheme = CACHE_HTTP_TYPE;
       theCache->open(clear, fix);
     }
-
-    if (config_volumes.num_stream_volumes != 0) {
-      theStreamCache         = new Cache();
-      theStreamCache->scheme = CACHE_RTSP_TYPE;
-      theStreamCache->open(clear, fix);
-    }
   }
 }
 
@@ -878,9 +868,10 @@ CacheProcessor::cacheInitialized()
 {
   int i;
 
-  if ((theCache && (theCache->ready == CACHE_INITIALIZING)) || (theStreamCache 
&& (theStreamCache->ready == CACHE_INITIALIZING))) {
+  if (theCache && (theCache->ready == CACHE_INITIALIZING)) {
     return;
   }
+
   int caches_ready  = 0;
   int cache_init_ok = 0;
   /* allocate ram size in proportion to the disk space the
@@ -900,14 +891,6 @@ CacheProcessor::cacheInitialized()
     total_size += theCache->cache_size;
     Debug("cache_init", "CacheProcessor::cacheInitialized - theCache, 
total_size = %" PRId64 " = %" PRId64 " MB", total_size,
           total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
-  }
-  if (theStreamCache) {
-    total_size += theStreamCache->cache_size;
-    Debug("cache_init", "CacheProcessor::cacheInitialized - theStreamCache, 
total_size = %" PRId64 " = %" PRId64 " MB", total_size,
-          total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
-  }
-
-  if (theCache) {
     if (theCache->ready == CACHE_INIT_FAILED) {
       Debug("cache_init", "CacheProcessor::cacheInitialized - failed to 
initialize the cache for http: cache disabled");
       Warning("failed to initialize the cache for http: cache disabled\n");
@@ -918,15 +901,6 @@ CacheProcessor::cacheInitialized()
       caches[CACHE_FRAG_TYPE_NONE] = theCache;
     }
   }
-  if (theStreamCache) {
-    if (theStreamCache->ready == CACHE_INIT_FAILED) {
-      Debug("cache_init", "CacheProcessor::cacheInitialized - failed to 
initialize the cache for streaming: cache disabled");
-      Warning("failed to initialize the cache for streaming: cache 
disabled\n");
-    } else {
-      caches_ready                 = caches_ready | (1 << 
CACHE_FRAG_TYPE_RTSP);
-      caches[CACHE_FRAG_TYPE_RTSP] = theStreamCache;
-    }
-  }
 
   // Update stripe version data.
   if (gnvol) { // start with whatever the first stripe is.
@@ -1016,11 +990,7 @@ CacheProcessor::cacheInitialized()
             ram_cache_bytes += (int64_t)(http_ram_cache_size * factor);
             CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, 
(int64_t)(http_ram_cache_size * factor));
           } else {
-            factor = (double)(int64_t)(gvol[i]->len >> STORE_BLOCK_SHIFT) / 
(int64_t)theStreamCache->cache_size;
-            Debug("cache_init", "CacheProcessor::cacheInitialized - factor = 
%f", factor);
-            gvol[i]->ram_cache->init((int64_t)(stream_ram_cache_size * 
factor), vol);
-            ram_cache_bytes += (int64_t)(stream_ram_cache_size * factor);
-            CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, 
(int64_t)(stream_ram_cache_size * factor));
+            ink_release_assert(!"Unexpected non-HTTP cache volume");
           }
           Debug("cache_init", "CacheProcessor::cacheInitialized[%d] - 
ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb", i,
                 ram_cache_bytes, ram_cache_bytes / (1024 * 1024));
@@ -2003,9 +1973,6 @@ CacheProcessor::mark_storage_offline(CacheDisk *d, ///< 
Target disk
   if (theCache) {
     rebuild_host_table(theCache);
   }
-  if (theStreamCache) {
-    rebuild_host_table(theStreamCache);
-  }
 
   zret = this->has_online_storage();
   if (!zret) {
@@ -2020,13 +1987,6 @@ CacheProcessor::mark_storage_offline(CacheDisk *d, ///< 
Target disk
       CacheProcessor::cache_ready &= caches_ready;
       Warning("all volumes for http cache are corrupt, http cache disabled");
     }
-    if (theStreamCache && 
!theStreamCache->hosttable->gen_host_rec.vol_hash_table) {
-      unsigned int caches_ready = 0;
-      caches_ready              = caches_ready | (1 << CACHE_FRAG_TYPE_RTSP);
-      caches_ready              = ~caches_ready;
-      CacheProcessor::cache_ready &= caches_ready;
-      Warning("all volumes for mixt cache are corrupt, mixt cache disabled");
-    }
   }
 
   return zret;
diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index 2f222bc..c5aa327 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -613,9 +613,8 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
   const char *matcher_name = "[CacheVolition]";
 
   memset(volume_seen, 0, sizeof(volume_seen));
-  num_volumes        = 0;
-  num_stream_volumes = 0;
-  num_http_volumes   = 0;
+  num_volumes      = 0;
+  num_http_volumes = 0;
 
   if (bufTok.Initialize(file_buf, SHARE_TOKS | ALLOW_EMPTY_TOKS) == 0) {
     // We have an empty file
@@ -752,7 +751,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
       if (scheme == CACHE_HTTP_TYPE) {
         num_http_volumes++;
       } else {
-        num_stream_volumes++;
+        ink_release_assert(!"Unexpected non-HTTP cache volume");
       }
       Debug("cache_hosting", "added volume=%d, scheme=%d, size=%d percent=%d", 
volume_number, scheme, size, in_percent);
     }
@@ -935,8 +934,7 @@ create_config(RegressionTest *t, int num)
         config_volumes.num_http_volumes++;
         rprintf(t, "volume=%d scheme=http size=%d\n", cp->number, cp->size);
       } else {
-        config_volumes.num_stream_volumes++;
-        rprintf(t, "volume=%d scheme=rtsp size=%d\n", cp->number, cp->size);
+        // ToDo: Assert ?
       }
     }
   } break;
@@ -1047,9 +1045,8 @@ ClearConfigVol(ConfigVolumes *configp)
     Warning("failed");
     return 0;
   }
-  configp->num_volumes        = 0;
-  configp->num_http_volumes   = 0;
-  configp->num_stream_volumes = 0;
+  configp->num_volumes      = 0;
+  configp->num_http_volumes = 0;
   return 1;
 }
 
diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
index e4b0614..e8b4df7 100644
--- a/iocore/cache/P_CacheHosting.h
+++ b/iocore/cache/P_CacheHosting.h
@@ -189,7 +189,6 @@ struct ConfigVol {
 struct ConfigVolumes {
   int num_volumes;
   int num_http_volumes;
-  int num_stream_volumes;
   Queue<ConfigVol> cp_queue;
   void read_config_file();
   void BuildListFromString(char *config_file_path, char *file_buf);
@@ -202,8 +201,7 @@ struct ConfigVolumes {
       cp_queue.pop();
     }
     // reset count variables
-    num_volumes        = 0;
-    num_http_volumes   = 0;
-    num_stream_volumes = 0;
+    num_volumes      = 0;
+    num_http_volumes = 0;
   }
 };
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index a2d4a4a..08f39b7 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -1024,7 +1024,6 @@ struct Cache {
 };
 
 extern Cache *theCache;
-extern Cache *theStreamCache;
 inkcoreapi extern Cache *caches[NUM_CACHE_FRAG_TYPES];
 
 TS_INLINE void

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to