You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2013/07/18 22:10:49 UTC
git commit: TS-2047: Schedule RamCacheCLFUSCompressor in
RamCacheCLFUS::init instead of immediatly after instantiation.
Updated Branches:
refs/heads/master 26950e51c -> ea560cecc
TS-2047: Schedule RamCacheCLFUSCompressor in RamCacheCLFUS::init instead
of immediatly after instantiation.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ea560cec
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ea560cec
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ea560cec
Branch: refs/heads/master
Commit: ea560cecc53c0c2563e3baf76a8d0fd2420ae953
Parents: 26950e5
Author: Phil Sorber <so...@apache.org>
Authored: Thu Jul 18 13:50:35 2013 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Jul 18 14:08:32 2013 -0600
----------------------------------------------------------------------
CHANGES | 3 ++
iocore/cache/RamCacheCLFUS.cc | 78 +++++++++++++++++++-------------------
2 files changed, 43 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ea560cec/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 02972a9..599f7bf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.3.5
+ *) [TS-2047] Schedule RamCacheCLFUSCompressor in RamCacheCLFUS::init instead
+ of immediatly after instantiation.
+
*) [TS-2042] Remove remnants of unused vingid command line option.
*) [TS-1898] improve cluster read/write performance.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ea560cec/iocore/cache/RamCacheCLFUS.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/RamCacheCLFUS.cc b/iocore/cache/RamCacheCLFUS.cc
index 6f290f0..5a0854a 100644
--- a/iocore/cache/RamCacheCLFUS.cc
+++ b/iocore/cache/RamCacheCLFUS.cc
@@ -99,6 +99,43 @@ struct RamCacheCLFUS : public RamCache {
seen(0), ncompressed(0), compressed(0) { }
};
+class RamCacheCLFUSCompressor : public Continuation {
+public:
+ RamCacheCLFUS *rc;
+ int mainEvent(int event, Event *e);
+
+ RamCacheCLFUSCompressor(RamCacheCLFUS *arc)
+ : rc(arc)
+ {
+ SET_HANDLER(&RamCacheCLFUSCompressor::mainEvent);
+ }
+};
+
+int
+RamCacheCLFUSCompressor::mainEvent(int /* event ATS_UNUSED */, Event *e)
+{
+ switch (cache_config_ram_cache_compress) {
+ default:
+ Warning("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
+ case CACHE_COMPRESSION_NONE:
+ case CACHE_COMPRESSION_FASTLZ:
+ break;
+ case CACHE_COMPRESSION_LIBZ:
+#if ! TS_HAS_LIBZ
+ Warning("libz not available for RAM cache compression");
+#endif
+ break;
+ case CACHE_COMPRESSION_LIBLZMA:
+#if ! TS_HAS_LZMA
+ Warning("lzma not available for RAM cache compression");
+#endif
+ break;
+ }
+ if (cache_config_ram_cache_compress_percent)
+ rc->compress_entries(e->ethread);
+ return EVENT_CONT;
+}
+
ClassAllocator<RamCacheCLFUSEntry> ramCacheCLFUSEntryAllocator("RamCacheCLFUSEntry");
static const int bucket_sizes[] = {
@@ -136,12 +173,14 @@ RamCacheCLFUS::resize_hashtable()
void
RamCacheCLFUS::init(int64_t abytes, Vol *avol)
{
+ ink_assert(avol != 0);
vol = avol;
max_bytes = abytes;
DDebug("ram_cache", "initializing ram_cache %" PRId64 " bytes", abytes);
if (!max_bytes)
return;
resize_hashtable();
+ eventProcessor.schedule_every(new RamCacheCLFUSCompressor(this), HRTIME_SECOND, ET_TASK);
}
#ifdef CHECK_ACOUNTING
@@ -318,6 +357,7 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
{
if (!cache_config_ram_cache_compress)
return;
+ ink_assert(vol != 0);
MUTEX_TAKE_LOCK(vol->mutex, thread);
if (!compressed) {
compressed = lru[0].head;
@@ -633,47 +673,9 @@ RamCacheCLFUS::fixup(INK_MD5 * key, uint32_t old_auxkey1, uint32_t old_auxkey2,
return 0;
}
-class RamCacheCLFUSCompressor : public Continuation {
-public:
- RamCacheCLFUS *rc;
- int mainEvent(int event, Event *e);
-
- RamCacheCLFUSCompressor(RamCacheCLFUS *arc)
- : rc(arc)
- {
- SET_HANDLER(&RamCacheCLFUSCompressor::mainEvent);
- }
-};
-
-int
-RamCacheCLFUSCompressor::mainEvent(int /* event ATS_UNUSED */, Event *e)
-{
- switch (cache_config_ram_cache_compress) {
- default:
- Warning("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
- case CACHE_COMPRESSION_NONE:
- case CACHE_COMPRESSION_FASTLZ:
- break;
- case CACHE_COMPRESSION_LIBZ:
-#if ! TS_HAS_LIBZ
- Warning("libz not available for RAM cache compression");
-#endif
- break;
- case CACHE_COMPRESSION_LIBLZMA:
-#if ! TS_HAS_LZMA
- Warning("lzma not available for RAM cache compression");
-#endif
- break;
- }
- if (cache_config_ram_cache_compress_percent)
- rc->compress_entries(e->ethread);
- return EVENT_CONT;
-}
-
RamCache *
new_RamCacheCLFUS()
{
RamCacheCLFUS *r = new RamCacheCLFUS;
- eventProcessor.schedule_every(new RamCacheCLFUSCompressor(r), HRTIME_SECOND, ET_TASK);
return r;
}