You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by we...@apache.org on 2013/12/04 04:39:08 UTC

[6/6] git commit: refine the codes of cluster

refine the codes of cluster


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

Branch: refs/heads/refine_cluster
Commit: 62504a9f82e7e862015aeb2393cda981ff78789e
Parents: 27246a5
Author: weijin <we...@apache.org>
Authored: Fri Oct 11 16:03:18 2013 +0800
Committer: weijin <ta...@taobao.com>
Committed: Wed Dec 4 11:37:40 2013 +0800

----------------------------------------------------------------------
 iocore/cache/Cache.cc                   |    2 +-
 iocore/cache/CacheRead.cc               |    2 +-
 iocore/cache/I_Cache.h                  |    2 +-
 iocore/cache/P_Cache.h                  |    2 +
 iocore/cache/P_CacheInternal.h          |    7 +-
 iocore/cluster/ClusterCache.cc          | 4679 +++++++++++++++-----------
 iocore/cluster/ClusterConfig.cc         |   80 +-
 iocore/cluster/ClusterMachine.cc        |   14 +-
 iocore/cluster/ClusterProcessor.cc      |  623 ++--
 iocore/cluster/ClusterVConnection.cc    |  548 ++-
 iocore/cluster/EventPoll.cc             |  158 +
 iocore/cluster/EventPoll.h              |  105 +
 iocore/cluster/Makefile.am              |    9 +-
 iocore/cluster/P_Cluster.h              |    2 +
 iocore/cluster/P_ClusterCache.h         |  367 +-
 iocore/cluster/P_ClusterCacheInternal.h |  374 +-
 iocore/cluster/P_ClusterInline.h        |  232 +-
 iocore/cluster/clusterinterface.h       |  104 +
 iocore/cluster/connection.cc            | 1726 ++++++++++
 iocore/cluster/connection.h             |   75 +
 iocore/cluster/global.cc                |   40 +
 iocore/cluster/global.h                 |   61 +
 iocore/cluster/machine.cc               |  269 ++
 iocore/cluster/machine.h                |   51 +
 iocore/cluster/message.cc               |  229 ++
 iocore/cluster/message.h                |   75 +
 iocore/cluster/nio.cc                   | 1701 ++++++++++
 iocore/cluster/nio.h                    |   60 +
 iocore/cluster/session.cc               | 1267 +++++++
 iocore/cluster/session.h                |   97 +
 iocore/cluster/types.h                  |  235 ++
 iocore/eventsystem/I_Event.h            |    1 +
 iocore/eventsystem/P_IOBuffer.h         |   20 +-
 mgmt/RecordsConfig.cc                   |   18 +
 34 files changed, 10851 insertions(+), 2384 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62504a9f/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 66f2b70..8d4b1e5 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -82,7 +82,7 @@ int cache_config_read_while_writer = 0;
 char cache_system_config_directory[PATH_NAME_MAX + 1];
 int cache_config_mutex_retry_delay = 2;
 #ifdef HTTP_CACHE
-static int enable_cache_empty_http_doc = 0;
+int enable_cache_empty_http_doc = 0;
 #endif
 
 #if TS_USE_INTERIM_CACHE == 1

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62504a9f/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 3c97305..90a7bd5 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -722,7 +722,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       return EVENT_DONE;
     // we have to keep reading until we give the user all the
     // bytes it wanted or we hit the watermark.
-    if (vio.ntodo() > 0 && !vio.buffer.writer()->high_water())
+    if (!f.cluster && vio.ntodo() > 0 && !vio.buffer.writer()->high_water())
       goto Lread;
     return EVENT_CONT;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62504a9f/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 00e4791..cd8dda9 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -193,7 +193,7 @@ struct CacheVConnection:public VConnection
   virtual void set_http_info(CacheHTTPInfo *info) = 0;
   virtual void get_http_info(CacheHTTPInfo **info) = 0;
 #endif
-
+  virtual bool is_read_from_writer() = 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;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62504a9f/iocore/cache/P_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_Cache.h b/iocore/cache/P_Cache.h
index ed738e3..e6bba36 100644
--- a/iocore/cache/P_Cache.h
+++ b/iocore/cache/P_Cache.h
@@ -44,4 +44,6 @@
 #include "P_CacheInternal.h"
 #include "P_CacheHosting.h"
 #include "P_CacheHttp.h"
+#include "clusterinterface.h"
+
 #endif /* _P_CACHE_H */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62504a9f/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 4f33fdc..e5f0a11 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -368,7 +368,9 @@ struct CacheVC: public CacheVConnection
   virtual time_t get_pin_in_cache();
   virtual bool set_disk_io_priority(int priority);
   virtual int get_disk_io_priority();
-
+  virtual bool is_read_from_writer() {
+    return f.read_from_writer_called;
+  }
   /** Get the fragment table.
       @return The address of the start of the fragment table,
       or @c NULL if there is no fragment table.
@@ -505,6 +507,7 @@ struct CacheVC: public CacheVConnection
 #ifdef HTTP_CACHE
       unsigned int allow_empty_doc:1; // used for cache empty http document
 #endif
+      unsigned int cluster:1;
     } f;
   };
   // BTF optimization used to skip reading stuff in cache partition that doesn't contain any
@@ -1054,7 +1057,7 @@ struct Cache
   Action *open_write(Continuation *cont, URL *url, CacheHTTPHdr *request,
                      CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
                      CacheFragType type = CACHE_FRAG_TYPE_HTTP);
-  static void generate_key(INK_MD5 *md5, URL *url, CacheHTTPHdr *request);
+  static void generate_key(INK_MD5 *md5, URL *url, CacheHTTPHdr *request = 0);
 #endif
 
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType type, char *hostname, int host_len);