You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/07/16 00:26:51 UTC

[1/2] git commit: TS-2003 Fix RAM cache stats when using clustering.

Updated Branches:
  refs/heads/master 71c3a3bf4 -> 3eba15053


TS-2003 Fix RAM cache stats when using clustering.

Review and minor const correctness changes: leif


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/00315b34
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/00315b34
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/00315b34

Branch: refs/heads/master
Commit: 00315b34172ea21bba90f04c1a3afd5813bb9a8f
Parents: 71c3a3b
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Jul 15 16:23:49 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jul 15 16:23:49 2013 -0600

----------------------------------------------------------------------
 iocore/cache/I_Cache.h                  | 2 +-
 iocore/cache/P_CacheInternal.h          | 2 +-
 iocore/cluster/ClusterCache.cc          | 7 +++++++
 iocore/cluster/ClusterVConnection.cc    | 1 +
 iocore/cluster/P_ClusterCache.h         | 9 +++++----
 iocore/cluster/P_ClusterCacheInternal.h | 9 +++++----
 proxy/http/HttpTransact.h               | 5 ++++-
 7 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index a925a14..4b1a3af 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -169,7 +169,7 @@ struct CacheVConnection:public VConnection
   virtual void get_http_info(CacheHTTPInfo **info) = 0;
 #endif
 
-  virtual bool is_ram_cache_hit() = 0;
+  virtual bool is_ram_cache_hit() const = 0;
   virtual bool set_disk_io_priority(int priority) = 0;
   virtual int get_disk_io_priority() = 0;
   virtual bool set_pin_in_cache(time_t t) = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 902fa63..4f33fdc 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -252,7 +252,7 @@ struct CacheVC: public CacheVConnection
   bool get_data(int i, void *data);
   bool set_data(int i, void *data);
 
-  bool is_ram_cache_hit()
+  bool is_ram_cache_hit() const
   {
     ink_assert(vio.op == VIO::READ);
     return !f.not_from_ram_cache;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index 4abcde8..1fa4ddb 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -1720,6 +1720,8 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
     if (cache_read) {
       int res;
 
+      msg->is_ram_cache_hit = ((CacheVC *)cache_vc)->is_ram_cache_hit();
+
       if (!cache_vc_info.valid()) {
         (void) getObjectSize(cache_vc, request_opcode, &cache_vc_info);
       }
@@ -2058,6 +2060,11 @@ cache_op_result_ClusterFunction(ClusterHandler *ch, void *d, int l)
         ci.destroy();
       return;
     }
+
+    // Update remote ram cache hit flag
+    if (msg->result == CACHE_EVENT_OPEN_READ)
+      c->read_cluster_vc->set_ram_cache_hit(msg->is_ram_cache_hit);
+
     // Try to send the message
 
     MUTEX_TRY_LOCK(lock, c->mutex, thread);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cluster/ClusterVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterVConnection.cc b/iocore/cluster/ClusterVConnection.cc
index 31e8e3e..d24e533 100644
--- a/iocore/cluster/ClusterVConnection.cc
+++ b/iocore/cluster/ClusterVConnection.cc
@@ -190,6 +190,7 @@ ClusterVConnection::ClusterVConnection(int is_new_connect_read)
      n_set_data_msgs(0),
      n_recv_set_data_msgs(0),
      pending_remote_fill(0),
+     remote_ram_cache_hit(0),
      have_all_data(0),
      initial_data_bytes(0),
      current_cont(0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cluster/P_ClusterCache.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCache.h b/iocore/cluster/P_ClusterCache.h
index 7adb431..2f9f157 100644
--- a/iocore/cluster/P_ClusterCache.h
+++ b/iocore/cluster/P_ClusterCache.h
@@ -539,6 +539,7 @@ struct ClusterVConnection: public ClusterVConnectionBase
   int n_recv_set_data_msgs;     // # set_data() msgs received on VC
   volatile int pending_remote_fill;     // Remote fill pending on connection
   Ptr<IOBufferBlock> read_block;   // Hold current data for open read
+  bool remote_ram_cache_hit;    // Entire object was from remote ram cache
   bool have_all_data;           // All data in read_block
   int initial_data_bytes;       // bytes in open_read buffer
   Ptr<IOBufferBlock> remote_write_block;   // Write side data for remote fill
@@ -565,6 +566,10 @@ struct ClusterVConnection: public ClusterVConnectionBase
   int disk_io_priority;
   void set_remote_fill_action(Action *);
 
+  // Indicates whether a cache hit was from an peering cluster cache
+  bool is_ram_cache_hit() const { return remote_ram_cache_hit; };
+  void set_ram_cache_hit(bool remote_hit) { remote_ram_cache_hit = remote_hit; }
+
   // For VC(s) established via OPEN_READ, we are passed a CacheHTTPInfo
   //  in the reply.
   virtual bool get_data(int id, void *data);    // backward compatibility
@@ -581,10 +586,6 @@ struct ClusterVConnection: public ClusterVConnectionBase
   virtual time_t get_pin_in_cache();
   virtual bool set_disk_io_priority(int priority);
   virtual int get_disk_io_priority();
-  bool is_ram_cache_hit()
-  {
-    return 0;
-  }
   virtual int get_header(void **ptr, int *len);
   virtual int set_header(void *ptr, int len);
   virtual int get_single_data(void **ptr, int *len);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/iocore/cluster/P_ClusterCacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
index 7c1658d..4bc8c12 100644
--- a/iocore/cluster/P_ClusterCacheInternal.h
+++ b/iocore/cluster/P_ClusterCacheInternal.h
@@ -570,8 +570,8 @@ struct CacheOpMsg_short_2:public ClusterMessageHeader
     MAX_VERSION = 1,
     CACHE_OP_SHORT_2_MESSAGE_VERSION = MAX_VERSION
   };
-    CacheOpMsg_short_2(uint16_t vers = CACHE_OP_SHORT_2_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0) {
+  CacheOpMsg_short_2(uint16_t vers = CACHE_OP_SHORT_2_MESSAGE_VERSION)
+    :  ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0) {
     memset(moi, 0, sizeof(moi));
   }
   //////////////////////////////////////////////////////////////////////////
@@ -606,6 +606,7 @@ struct CacheOpReplyMsg:public ClusterMessageHeader
   uint32_t seq_number;
   int32_t result;
   ClusterVCToken token;
+  bool is_ram_cache_hit;          // Entire object was from ram cache
   uint8_t moi[4];                 // Used by CACHE_OPEN_READ & CACHE_LINK reply
   enum
   {
@@ -613,8 +614,8 @@ struct CacheOpReplyMsg:public ClusterMessageHeader
     MAX_VERSION = 1,
     CACHE_OP_REPLY_MESSAGE_VERSION = MAX_VERSION
   };
-  CacheOpReplyMsg(uint16_t vers = CACHE_OP_REPLY_MESSAGE_VERSION):
-  ClusterMessageHeader(vers), seq_number(0), result(0) {
+  CacheOpReplyMsg(uint16_t vers = CACHE_OP_REPLY_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), seq_number(0), result(0), is_ram_cache_hit(false) {
     memset(moi, 0, sizeof(moi));
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00315b34/proxy/http/HttpTransact.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 9d0009a..dab46d2 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -659,7 +659,10 @@ public:
         config(),
         directives(),
         open_read_retries(0),
-        open_write_retries(0), write_lock_state(CACHE_WL_INIT), lookup_count(0), is_ram_cache_hit(false)
+        open_write_retries(0),
+      write_lock_state(CACHE_WL_INIT),
+      lookup_count(0),
+      is_ram_cache_hit(false)
     { }
   } CacheLookupInfo;
 


[2/2] git commit: Added TS-2003.

Posted by zw...@apache.org.
Added TS-2003.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3eba1505
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3eba1505
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3eba1505

Branch: refs/heads/master
Commit: 3eba1505355ddcfa8b62458bb601f068eebbfd9d
Parents: 00315b3
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jul 15 16:25:37 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jul 15 16:26:19 2013 -0600

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3eba1505/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bdb912f..aec10a3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 3.3.5
 
 
+  *) [TS-2003] Fix RAM cache stats when using cluster. Author: Yunkai Zhang.
+
   *) [TS-1820] Cleanup UNUSED / INK_UNUSED / RELEASE_UNUSED. This also removes
    the entire mgmt/tools directory, and relevant support in traffic_shell for
    managing network interfaces.